summaryrefslogtreecommitdiff
path: root/miniircd
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2015-08-16 22:42:35 +0200
committerJoel Rosdahl <joel@rosdahl.net>2015-08-16 22:42:35 +0200
commitca46821c01923e631f543030d583ba135562e681 (patch)
treee29d5b662d1770546f52e3fe4d10190057adc124 /miniircd
parent9452a026ee871b61620820dd153d96ced3462070 (diff)
downloadminiircd-ca46821c01923e631f543030d583ba135562e681.tar.gz
miniircd-ca46821c01923e631f543030d583ba135562e681.zip
Handle quickly disconnecting client without crashing
Diffstat (limited to 'miniircd')
-rwxr-xr-xminiircd12
1 files changed, 9 insertions, 3 deletions
diff --git a/miniircd b/miniircd
index 34847e8..c864188 100755
--- a/miniircd
+++ b/miniircd
@@ -793,9 +793,15 @@ class Server(object):
"SSL error for connection from %s:%s: %s" % (
addr[0], addr[1], e))
continue
- self.clients[conn] = Client(self, conn)
- self.print_info("Accepted connection from %s:%s." % (
- addr[0], addr[1]))
+ try:
+ self.clients[conn] = Client(self, conn)
+ self.print_info("Accepted connection from %s:%s." % (
+ addr[0], addr[1]))
+ except socket.error as e:
+ try:
+ conn.close()
+ except:
+ pass
for x in owtd:
if x in self.clients: # client may have been disconnected
self.clients[x].socket_writable_notification()