home
·
contact
·
privacy
projects
/
plomrogue2-experiments
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactor web client keybindings code.
[plomrogue2-experiments]
/
new2
/
plomrogue
/
io_tcp.py
diff --git
a/new2/plomrogue/io_tcp.py
b/new2/plomrogue/io_tcp.py
index f0a49a97dad632fa4f3dc10770432f424ba90155..b030f1b9f1c98332084763812bf152666004bb7a 100644
(file)
--- a/
new2/plomrogue/io_tcp.py
+++ b/
new2/plomrogue/io_tcp.py
@@
-6,6
+6,7
@@
socketserver.TCPServer.allow_reuse_address = True
+from plomrogue.errors import BrokenSocketConnection
class PlomSocket:
def __init__(self, socket):
class PlomSocket:
def __init__(self, socket):
@@
-32,7
+33,6
@@
class PlomSocket:
<http://stackoverflow.com/q/34919846>
"""
<http://stackoverflow.com/q/34919846>
"""
- from plomrogue.errors import BrokenSocketConnection
escaped_message = ''
for char in message:
if char in ('\\', '$'):
escaped_message = ''
for char in message:
if char in ('\\', '$'):
@@
-77,7
+77,11
@@
class PlomSocket:
data = b''
msg = b''
while True:
data = b''
msg = b''
while True:
- data = self.socket.recv(1024)
+ try:
+ data = self.socket.recv(1024)
+ except OSError as err:
+ if err.errno == 9: # "Bad file descriptor", when connection broken
+ raise BrokenSocketConnection
if 0 == len(data):
break
for c in data:
if 0 == len(data):
break
for c in data: