代码拉取完成,页面将自动刷新
同步操作将从 likecg/kbengine 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*
This source file is part of KBEngine
For the latest info, see http://www.kbengine.org/
Copyright (c) 2008-2012 KBEngine.
KBEngine is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KBEngine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with KBEngine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MACHINE_H__
#define __MACHINE_H__
// common include
#include "server/kbemain.hpp"
#include "server/serverapp.hpp"
#include "server/idallocate.hpp"
#include "server/serverconfig.hpp"
#include "cstdkbe/timer.hpp"
#include "network/endpoint.hpp"
#include "network/udp_packet_receiver.hpp"
#include "network/common.hpp"
//#define NDEBUG
#include <map>
// windows include
#if KBE_PLATFORM == PLATFORM_WIN32
#else
// linux include
#endif
namespace KBEngine{
class Machine: public ServerApp,
public Singleton<Machine>
{
public:
enum TimeOutType
{
TIMEOUT_GAME_TICK = TIMEOUT_SERVERAPP_MAX + 1
};
Machine(Mercury::EventDispatcher& dispatcher,
Mercury::NetworkInterface& ninterface,
COMPONENT_TYPE componentType,
COMPONENT_ID componentID);
~Machine();
bool run();
bool findBroadcastInterface();
/** 网络接口
某个app广播了自己的地址
*/
void onBroadcastInterface(Mercury::Channel* pChannel, int32 uid, std::string& username,
int8 componentType, uint64 componentID, uint64 componentIDEx,
int8 globalorderid, int8 grouporderid,
uint32 intaddr, uint16 intport,
uint32 extaddr, uint16 extport, uint32 pid,
float cpu, float mem, uint32 usedmem, int8 state, uint32 machineID, uint64 extradata,
uint64 extradata1, uint64 extradata2, uint64 extradata3);
/** 网络接口
某个app寻找另一个app的地址
*/
void onFindInterfaceAddr(Mercury::Channel* pChannel, int32 uid, std::string& username,
int8 componentType, uint64 componentID, int8 findComponentType, uint32 finderAddr, uint16 finderRecvPort);
/** 网络接口
查询所有接口信息
*/
void onQueryAllInterfaceInfos(Mercury::Channel* pChannel, int32 uid, std::string& username,
uint16 finderRecvPort);
void handleTimeout(TimerHandle handle, void * arg);
/* 初始化相关接口 */
bool initializeBegin();
bool inInitialize();
bool initializeEnd();
void finalise();
bool initNetwork();
/** 网络接口
启动服务器
@uid: 提供启动的uid参数
@components: 启动哪些组件(可能采取分布式启动方案)
*/
void startserver(Mercury::Channel* pChannel, KBEngine::MemoryStream& s);
/** 网络接口
关闭服务器
@uid: 提供启动的uid参数
*/
void stopserver(Mercury::Channel* pChannel, KBEngine::MemoryStream& s);
protected:
// udp广播地址
u_int32_t broadcastAddr_;
Mercury::EndPoint ep_;
Mercury::EndPoint epBroadcast_;
Mercury::EndPoint epLocal_;
Mercury::UDPPacketReceiver* pEPPacketReceiver_;
Mercury::UDPPacketReceiver* pEBPacketReceiver_;
Mercury::UDPPacketReceiver* pEPLocalPacketReceiver_;
// 本机使用的uid
std::vector<int32> localuids_;
};
}
#endif
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。