Commit fa2cffe2 authored by Luke Macken's avatar Luke Macken

ipc: Catch exceptions when trying to close the sockets

parent dd1f927a
...@@ -24,6 +24,7 @@ import stat ...@@ -24,6 +24,7 @@ import stat
import socket import socket
import struct import struct
import tempfile import tempfile
import traceback
import subprocess import subprocess
import platform import platform
...@@ -205,10 +206,13 @@ class PyrasiteIPC(object): ...@@ -205,10 +206,13 @@ class PyrasiteIPC(object):
return data return data
def close(self): def close(self):
if self.sock: try:
self.sock.close() if self.sock:
if getattr(self, 'server_sock', None): self.sock.close()
self.server_sock.close() if getattr(self, 'server_sock', None):
self.server_sock.close()
except:
traceback.print_exc()
def __repr__(self): def __repr__(self):
return "<%s %s>" % (self.__class__.__name__, self.pid) return "<%s %s>" % (self.__class__.__name__, self.pid)
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