Bug 1299216 - Don't care about socket not connected for sock.shutdown() call. r=automatedtester
authorHenrik Skupin <mail@hskupin.info>
Wed, 21 Sep 2016 16:04:49 +0200
changeset 351600 46fd1d89a918e2af60c2dfe8284925e30976c495
parent 351599 7c0bdd869d2a58bbbad65d8bd1952ee0f39caf54
child 351601 8463d0e5bf289bd05ed23efddb119eee82ff6c03
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester
bugs1299216
milestone52.0a1
Bug 1299216 - Don't care about socket not connected for sock.shutdown() call. r=automatedtester MozReview-Commit-ID: 9DXLY66KqTg
testing/marionette/client/marionette_driver/transport.py
--- a/testing/marionette/client/marionette_driver/transport.py
+++ b/testing/marionette/client/marionette_driver/transport.py
@@ -271,14 +271,20 @@ class TcpTransport(object):
         self.last_id = self.last_id + 1
         cmd = Command(self.last_id, name, params)
         self.send(cmd)
         return self.receive()
 
     def close(self):
         """Close the socket."""
         if self.sock:
-            self.sock.shutdown(socket.SHUT_RDWR)
+            try:
+                self.sock.shutdown(socket.SHUT_RDWR)
+            except IOError as exc:
+                # Errno 57 is "socket not connected", which we don't care about here.
+                if exc.errno != 57:
+                    raise
+
             self.sock.close()
             self.sock = None
 
     def __del__(self):
         self.close()