From: Mikko Rasa Date: Wed, 6 Apr 2011 07:33:08 +0000 (+0000) Subject: Prevent certain network errors from crashing the program X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=e8d06e16ab1679eb87e21cbfa788eea02144927d;p=r2c2.git Prevent certain network errors from crashing the program --- diff --git a/source/network/server.cpp b/source/network/server.cpp index 43d22ff..b3f4662 100644 --- a/source/network/server.cpp +++ b/source/network/server.cpp @@ -1,7 +1,7 @@ /* $Id$ This file is part of R²C² -Copyright © 2009-2010 Mikkosoft Productions, Mikko Rasa +Copyright © 2009-2011 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ @@ -117,8 +117,17 @@ template void Server::send(const P &pkt) { for(vector::const_iterator i=connections.begin(); i!=connections.end(); ++i) - if(!(*i)->stale) - (*i)->comm.send(pkt); + if(!(*i)->stale && (*i)->comm.is_handshake_done()) + { + try + { + (*i)->comm.send(pkt); + } + catch(...) + { + (*i)->stale = true; + } + } }