Skip to content

Commit 35c5ccf

Browse files
committedAug 8, 2013
Don't freak out when a client sends multiple TOSERVER_INIT packets; also log one thing more.
1 parent 2ed3067 commit 35c5ccf

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed
 

‎src/server.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,15 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
18101810
if(datasize < 2+1+PLAYERNAME_SIZE)
18111811
return;
18121812

1813-
verbosestream<<"Server: Got TOSERVER_INIT from "<<addr_s<<std::endl;
1813+
// If net_proto_version is set, this client has already been handled
1814+
if(getClient(peer_id)->net_proto_version != 0){
1815+
verbosestream<<"Server: Ignoring multiple TOSERVER_INITs from "
1816+
<<addr_s<<" (peer_id="<<peer_id<<")"<<std::endl;
1817+
return;
1818+
}
1819+
1820+
verbosestream<<"Server: Got TOSERVER_INIT from "<<addr_s<<" (peer_id="
1821+
<<peer_id<<")"<<std::endl;
18141822

18151823
// Do not allow multiple players in simple singleplayer mode.
18161824
// This isn't a perfect way to do it, but will suffice for now.
@@ -4651,6 +4659,8 @@ void Server::DenyAccess(u16 peer_id, const std::wstring &reason)
46514659

46524660
// If there are way too many clients, get rid of denied new ones immediately
46534661
if(m_clients.size() > 2 * g_settings->getU16("max_users")){
4662+
verbosestream<<"Server: DenyAccess: Too many clients; getting rid of "
4663+
<<"peer_id="<<peer_id<<" immediately"<<std::endl;
46544664
// Delete peer to stop sending it data
46554665
m_con.DeletePeer(peer_id);
46564666
// Delete client also to stop block sends and other stuff

1 commit comments

Comments
 (1)

Bremaweb commented on Aug 8, 2013

@Bremaweb
Contributor

Is this supposed to help the fail to emerge player issues?

Please sign in to comment.