Unverified Commit 16a0fc3e authored by Giuseppe Carboni's avatar Giuseppe Carboni Committed by GitHub
Browse files

Fix for IRAPy Connection class (#703)

* Fix #700, IRAPy now imports Connection class, not module

This will fix the PyCalmux component behavior

* Fix #700, fixed a major issue in Connection class
parent 184400d2
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -22,12 +22,13 @@ class Connection(object):

    def __init__(self, address, timeout=2):
        self.address = address
        self.timeout = timeout

    def __enter__(self):
        self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        connected = 1
        t0 = time.time()
        while time.time() - t0 < timeout:
        while time.time() - t0 < self.timeout:
            connected = self.s.connect_ex(self.address)
            if connected == 0:
                break