2014-02-15 83 views
-1

我得到的错误是:错误13错误C2011:'ConnectionInfo':'结构'类型redefinition \ src \ server \ authserver \ server \ RealmSocket.h 33错误13错误C2011:'ConnectionInfo':'结构'类型重新定义

基本上我从某人那里得到了这个,我不能再联系他了,我想让它工作。

后,我做了什么乔纳斯告诉我,我还是得到这样的:“ConnectionInfo”:未声明的标识符的\ src \服务器\游戏\服务器\ WorldSocket.h 54

林不知道如果 ---一/src/server/authserver/Server/RealmSocket.cpp +++ b/src/server/authserver/Server/RealmSocket.cpp

表示我应该删除a/src/server/authserver/Server/RealmSocket。 cpp从那里。

diff --git a/src/server/authserver/Server/RealmSocket.cpp b/src/server/authserver /Server/RealmSocket.cpp 
index 6710a6a..0d2a854 100644 
--- a/src/server/authserver/Server/RealmSocket.cpp 
+++ b/src/server/authserver/Server/RealmSocket.cpp 
@@ -23,6 +23,8 @@ 


@@ -64,6 +70,17 @@ int RealmSocket::open(void * arg) 
_remoteAddress = addr.get_host_addr(); 
_remotePort = addr.get_port_number(); 

+ time_t currentTime = time(NULL); 
+ 
+ AntiConnectionFloodMap::iterator itr = activeConnections.find(_remoteAddress); 
+ if (itr != activeConnections.end()) 
+ { 
+  if (currentTime <= itr->second.lastConnectionTime +  MAX_CONNECTION_WAIT_TIME || ++itr->second.connectionAmount == MAX_CONNECTION_PER_IP) 
+   return -1; 
+ 
+   itr->second.lastConnectionTime = currentTime; 
+0

之后我删除了,一旦我得到this'ConnectionInfo ':未声明的标识符的\ src \服务器\游戏\服务器\ WorldSocket.h 54 – user3313106

回答

2

这是在代码中定义两次。删除其中一个。

struct ConnectionInfo 

{ 
ConnectionInfo(time_t currentTime) : lastConnectionTime(currentTime), connectionAmount(1) {} 
time_t lastConnectionTime; 
uint16 connectionAmount; 

}; 
+0

之后我删除了,一旦我得到this'ConnectionInfo':未声明的标识符的\ src \服务器\ game \ Server \ WorldSocket.h 54 – user3313106

+0

不,你需要删除第33行的realmsocket.h中的一个,就像它在错误信息中说的那样。 –