Commit b030bb18 authored by Denis Bilenko's avatar Denis Bilenko

socket: make shutdown() cancel socket's events

parent 3065c331
...@@ -533,6 +533,17 @@ class socket(object): ...@@ -533,6 +533,17 @@ class socket(object):
def gettimeout(self): def gettimeout(self):
return self.timeout return self.timeout
def shutdown(self, how):
cancel_wait(self._rw_event)
if how == 0: # SHUT_RD
cancel_wait(self._read_event)
elif how == 1: # SHUT_RW
cancel_wait(self._write_event)
else:
cancel_wait(self._read_event)
cancel_wait(self._write_event)
self._sock.shutdown(how)
family = property(lambda self: self._sock.family, doc="the socket family") family = property(lambda self: self._sock.family, doc="the socket family")
type = property(lambda self: self._sock.type, doc="the socket type") type = property(lambda self: self._sock.type, doc="the socket type")
proto = property(lambda self: self._sock.proto, doc="the socket protocol") proto = property(lambda self: self._sock.proto, doc="the socket protocol")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment