错误13错误C2011:'ConnectionInfo':'struct'类型重定义

时间:2014-02-15 10:58:15

标签: c++

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

基本上我从某人那里得到了这个,我再也无法联系他了,我想让它发挥作用。

在我做了乔纳斯告诉我的事情之后,我仍然得到这个:'ConnectionInfo':未声明的标识符\ src \ server \ game \ Server \ WorldSocket.h 54

我不确定是否     --- a / 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;

1 个答案:

答案 0 :(得分:2)

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

struct ConnectionInfo

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

};