[stacklessexamples] r173 committed - All (not blocking related) socket errors when writing to a socket are ...

2 views
Skip to first unread message

stackles...@googlecode.com

unread,
Jan 6, 2011, 11:11:06 PM1/6/11
to stackless-exa...@googlegroups.com
Revision: 173
Author: richar...@gmail.com
Date: Thu Jan 6 20:10:50 2011
Log: All (not blocking related) socket errors when writing to a socket are
now propagated up to the high level user/sender of the stackless socket.
This helps in situations where on the PS3 it tells you that a broken pipe
was encountered, and on Windows it says ECONNRESET.
http://code.google.com/p/stacklessexamples/source/detail?r=173

Modified:
/trunk/examples/networking/stacklesssocket.py

=======================================
--- /trunk/examples/networking/stacklesssocket.py Thu Jan 6 18:59:06 2011
+++ /trunk/examples/networking/stacklesssocket.py Thu Jan 6 20:10:50 2011
@@ -37,7 +37,7 @@
# internal version of this module in use at CCP Games.
#

-import stackless
+import stackless #, logging
import asyncore, weakref, time, select, types, sys, gc
from collections import deque

@@ -678,15 +678,16 @@
result = self.socket.send(data, flags)
return result
except stdsocket.error, why:
+ # logging.root.exception("SOME SEND ERROR")
if why.args[0] == EWOULDBLOCK:
return 0
- elif why.args[0] in (ECONNRESET, ENOTCONN, ESHUTDOWN,
ECONNABORTED):
- # Ensure the sender appears to have directly
received this exception.
- channel.send_exception(why.__class__, *why.args)
+
+ # Ensure the sender appears to have directly received
this exception.
+ channel.send_exception(why.__class__, *why.args)
+
+ if why.args[0] in (ECONNRESET, ENOTCONN, ESHUTDOWN,
ECONNABORTED):
self.handle_close()
- return 0
- else:
- raise
+ return 0

nbytes = asyncore_send(self, data, flags)
if channel.balance < 0:

Reply all
Reply to author
Forward
0 new messages