Commit c319b065 authored by Julien Muchembled's avatar Julien Muchembled

Remove useless socket shutdown on close

shutdown is implicit because we don't duplicate sockets.
parent 19745e7c
...@@ -275,7 +275,6 @@ class BaseConnection(object): ...@@ -275,7 +275,6 @@ class BaseConnection(object):
em.removeReader(self) em.removeReader(self)
em.removeWriter(self) em.removeWriter(self)
em.unregister(self) em.unregister(self)
self.connector.shutdown()
self.connector.close() self.connector.close()
self.connector = None self.connector = None
self.aborted = False self.aborted = False
......
...@@ -105,13 +105,6 @@ class SocketConnector: ...@@ -105,13 +105,6 @@ class SocketConnector:
raise ConnectorException, 'getNewConnection failed: %s:%s' % \ raise ConnectorException, 'getNewConnection failed: %s:%s' % \
(err, errmsg) (err, errmsg)
def shutdown(self):
# This may fail if the socket is not connected.
try:
self.socket.shutdown(socket.SHUT_RDWR)
except socket.error:
pass
def receive(self): def receive(self):
try: try:
return self.socket.recv(4096) return self.socket.recv(4096)
......
...@@ -79,9 +79,6 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -79,9 +79,6 @@ class ConnectionTests(NeoUnitTestBase):
def _checkWriterRemoved(self, n=1): def _checkWriterRemoved(self, n=1):
self.assertEqual(len(self.em.mockGetNamedCalls("removeWriter")), n) self.assertEqual(len(self.em.mockGetNamedCalls("removeWriter")), n)
def _checkShutdown(self, n=1):
self.assertEqual(len(self.connector.mockGetNamedCalls("shutdown")), n)
def _checkClose(self, n=1): def _checkClose(self, n=1):
self.assertEqual(len(self.connector.mockGetNamedCalls("close")), n) self.assertEqual(len(self.connector.mockGetNamedCalls("close")), n)
...@@ -523,7 +520,6 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -523,7 +520,6 @@ class ConnectionTests(NeoUnitTestBase):
self.assertTrue(bc.pending()) self.assertTrue(bc.pending())
self._checkWriterRemoved(0) self._checkWriterRemoved(0)
self._checkReaderRemoved(0) self._checkReaderRemoved(0)
self._checkShutdown(0)
self._checkClose(0) self._checkClose(0)
finally: finally:
del DoNothingConnector.send del DoNothingConnector.send
...@@ -550,7 +546,6 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -550,7 +546,6 @@ class ConnectionTests(NeoUnitTestBase):
self.assertFalse(bc.pending()) self.assertFalse(bc.pending())
self._checkWriterRemoved(1) self._checkWriterRemoved(1)
self._checkReaderRemoved(0) self._checkReaderRemoved(0)
self._checkShutdown(0)
self._checkClose(0) self._checkClose(0)
finally: finally:
del DoNothingConnector.send del DoNothingConnector.send
...@@ -578,7 +573,6 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -578,7 +573,6 @@ class ConnectionTests(NeoUnitTestBase):
self.assertFalse(bc.pending()) self.assertFalse(bc.pending())
self._checkWriterRemoved(1) self._checkWriterRemoved(1)
self._checkReaderRemoved(1) self._checkReaderRemoved(1)
self._checkShutdown(1)
self._checkClose(1) self._checkClose(1)
finally: finally:
del DoNothingConnector.send del DoNothingConnector.send
...@@ -610,7 +604,6 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -610,7 +604,6 @@ class ConnectionTests(NeoUnitTestBase):
self._checkUnregistered(0) self._checkUnregistered(0)
self._checkWriterRemoved(0) self._checkWriterRemoved(0)
self._checkReaderRemoved(0) self._checkReaderRemoved(0)
self._checkShutdown(0)
self._checkClose(0) self._checkClose(0)
finally: finally:
del DoNothingConnector.receive del DoNothingConnector.receive
...@@ -710,7 +703,6 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -710,7 +703,6 @@ class ConnectionTests(NeoUnitTestBase):
self._checkReaderAdded(1) self._checkReaderAdded(1)
self._checkWriterRemoved(1) self._checkWriterRemoved(1)
self._checkReaderRemoved(0) self._checkReaderRemoved(0)
self._checkShutdown(0)
self._checkClose(0) self._checkClose(0)
finally: finally:
del DoNothingConnector.send del DoNothingConnector.send
......
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