tsileo/pycgminer

exception thrown when socket is already closed

ixje opened this issue · 0 comments

ixje commented

I get the following exception when running it against a remote miner (cgminer 3.7.2)

     27             received = self._receive(sock)
     28         finally:
---> 29             sock.shutdown(socket.SHUT_RDWR)
     30             sock.close()
     31 
error: [Errno 57] Socket is not connected

It can easily be solved by catching the above exception as follow:

        finally:
            try:
                sock.shutdown(socket.SHUT_RDWR)
            except socket.error:
                pass
            sock.close()