From e8d06e16ab1679eb87e21cbfa788eea02144927d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 6 Apr 2011 07:33:08 +0000 Subject: [PATCH] Prevent certain network errors from crashing the program --- source/network/server.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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; + } + } } -- 2.45.2