summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2009-11-22 19:22:55 +0100
committerGuillaume Seguin <guillaume@segu.in>2009-11-22 19:22:55 +0100
commitc164658ee789b29583d4651d93627720abfe3609 (patch)
tree57a13862afdedc4ff372bde0dd80831f23c81ce7
parent73ccad6bc5f27c623851e9adcf05af1b74b91be2 (diff)
downloadnetnavalbattle-c164658ee789b29583d4651d93627720abfe3609.tar.gz
netnavalbattle-c164658ee789b29583d4651d93627720abfe3609.tar.bz2
Silently handle write-after-connection-lost
-rw-r--r--netnavalbattle/server.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/netnavalbattle/server.py b/netnavalbattle/server.py
index 713b96a..5bce300 100644
--- a/netnavalbattle/server.py
+++ b/netnavalbattle/server.py
@@ -3,6 +3,7 @@ import event
import parser
import context
+import socket
import logging
class NetNavalBattleServer (connection.ServerConnection):
@@ -31,7 +32,13 @@ class NetNavalBattleServer (connection.ServerConnection):
ev_desc = ev.describe ()
logging.log (logging.INFO, "Sending event to %s:%d : %s" \
% (self._addresses[sock] + (ev_desc,)))
- sock.send (self._parsers[sock].prepare (ev_desc))
+ try:
+ sock.send (self._parsers[sock].prepare (ev_desc))
+ except socket.error, se:
+ if se.errno == 32:
+ pass
+ else:
+ raise
def on_accept (self, sock):
"""@doc"""