Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ylmbtm committed Aug 17, 2020
1 parent 0fd4b14 commit 0ebae58
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Server/Src/ProxyServer/ProxyMsgHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ BOOL CProxyMsgHandler::OnMsgRoleLogoutReq(NetPacket* pPacket)

RelayToLogicServer(pPacket->m_pDataBuffer);

CConnection* pConnection = ServiceBase::GetInstancePtr()->GetConnectionByID(pPacketHeader->dwUserData);
CConnection* pConnection = ServiceBase::GetInstancePtr()->GetConnectionByID(pPacket->m_dwConnID);
ERROR_RETURN_TRUE(pConnection != NULL);
pConnection->SetConnectionData(0);
return TRUE;
Expand Down
1 change: 1 addition & 0 deletions Server/Src/PublicData/WebActionDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ enum EWebAction
EWA_KICKOFF_PLAYER, //踢玩家下线
EWA_PAY_CALLBACK, //充值回调通知
EWA_DELTE_MAIL, //删除邮件
EWA_NOTICE_POPUP, //游戏弹窗公告
};


Expand Down
2 changes: 2 additions & 0 deletions Server/Src/ServerData/ServerDefine.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ enum ERoleProperty
ERP_ID = 1,
ERP_LEVEL,
ERP_VIPLEVEL,
ERP_EXP,
ERP_CHANNEL,
};

#endif //__SERVER_STRUCT_H__
16 changes: 16 additions & 0 deletions Server/Src/ServerEngine/CommonSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ UINT32 CommonSocket::NetToHost(UINT32 nValue)
return ntohl(nValue);
}

VOID CommonSocket::IgnoreSignal()
{
#ifdef WIN32

#else
struct sigaction sig;
sigemptyset(&sig.sa_mask);
sig.sa_flags = 0;
sig.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &sig, 0);
sigaction(SIGHUP, &sig, 0);
#endif
}

BOOL CommonSocket::SetSocketNoDelay(SOCKET hSocket)
{
int bOn = 1;
Expand All @@ -97,6 +111,8 @@ BOOL CommonSocket::InitNetwork()
{
return FALSE;
}
#else
IgnoreSignal();
#endif
return TRUE;
}
Expand Down
8 changes: 2 additions & 6 deletions Server/Src/ServerEngine/CommonSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ BOOL SetSocketNoDelay(SOCKET hSocket);

BOOL SetSocketKeepAlive( SOCKET hSocket, int nKeepInterval, int nKeepCount, int nKeepIdle );

//初始化网络
BOOL InitNetwork();

//反初始化网络
BOOL UninitNetwork();

SOCKET CreateSocket( int af = AF_INET, int type = SOCK_STREAM, int protocol = 0);
Expand All @@ -33,16 +31,12 @@ INT32 GetSocketLastError();

BOOL IsSocketValid(SOCKET hSocket);

//关闭套接字发送
void ShutDownSend(SOCKET hSocket);

//关闭套接字接收
void ShutDownRecv(SOCKET hSocket);

//关闭套接字
void CloseSocket(SOCKET hSocket);

//取本机IP地址
std::string GetLocalIP();

UINT32 IpAddrStrToInt(CHAR* pszIpAddr);
Expand All @@ -59,6 +53,8 @@ UINT32 HostToNet(UINT32 nValue);

UINT32 NetToHost(UINT32 nValue);

VOID IgnoreSignal();

#ifdef WIN32
BOOL ConnectSocketEx(SOCKET hSocket, const char* pAddr, short sPort, LPOVERLAPPED lpOverlapped);

Expand Down
2 changes: 1 addition & 1 deletion Server/Src/ServerEngine/ServiceBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ BOOL ServiceBase::StartNetwork(UINT16 nPortNum, UINT32 nMaxConn, IPacketDispatch

m_pPacketDispatcher = pDispather;

if (!CNetManager::GetInstancePtr()->Start(nPortNum, nMaxConn, this))
if (!CNetManager::GetInstancePtr()->Start(nPortNum, nMaxConn, this, strListenIp))
{
CLog::GetInstancePtr()->LogError("启动网络层失败!");
return FALSE;
Expand Down

0 comments on commit 0ebae58

Please sign in to comment.