clients are now dropped if they don't act as normal clients (fixes #235)

This commit is contained in:
Choupom 2010-11-01 11:42:43 +01:00 committed by oy
parent c45dc374ff
commit 4383e10933

View file

@ -194,7 +194,6 @@ void CNetConnection::Disconnect(const char *pReason)
int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr) int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
{ {
int64 Now = time_get(); int64 Now = time_get();
m_LastRecvTime = Now;
// check if resend is requested // check if resend is requested
if(pPacket->m_Flags&NET_PACKETFLAG_RESEND) if(pPacket->m_Flags&NET_PACKETFLAG_RESEND)
@ -256,27 +255,20 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
// connection made // connection made
if(CtrlMsg == NET_CTRLMSG_CONNECTACCEPT) if(CtrlMsg == NET_CTRLMSG_CONNECTACCEPT)
{ {
m_LastRecvTime = Now;
SendControl(NET_CTRLMSG_ACCEPT, 0, 0); SendControl(NET_CTRLMSG_ACCEPT, 0, 0);
m_State = NET_CONNSTATE_ONLINE; m_State = NET_CONNSTATE_ONLINE;
if(g_Config.m_Debug) if(g_Config.m_Debug)
dbg_msg("connection", "got connect+accept, sending accept. connection online"); dbg_msg("connection", "got connect+accept, sending accept. connection online");
} }
} }
else if(State() == NET_CONNSTATE_ONLINE)
{
// connection made
/*
if(ctrlmsg == NET_CTRLMSG_CONNECTACCEPT)
{
}*/
}
} }
} }
else else
{ {
if(State() == NET_CONNSTATE_PENDING) if(State() == NET_CONNSTATE_PENDING)
{ {
m_LastRecvTime = Now;
m_State = NET_CONNSTATE_ONLINE; m_State = NET_CONNSTATE_ONLINE;
if(g_Config.m_Debug) if(g_Config.m_Debug)
dbg_msg("connection", "connecting online"); dbg_msg("connection", "connecting online");
@ -285,6 +277,7 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
if(State() == NET_CONNSTATE_ONLINE) if(State() == NET_CONNSTATE_ONLINE)
{ {
m_LastRecvTime = Now;
AckChunks(pPacket->m_Ack); AckChunks(pPacket->m_Ack);
} }