Skip to content

Commit

Permalink
Dont track ports used by client
Browse files Browse the repository at this point in the history
The are not released and the client should not care if the same port is used multiple times.

Refs #63
  • Loading branch information
sverhoeven committed Mar 13, 2020
1 parent 3c7c078 commit 6e35068
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions grpc4bmi/bmi_grpc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class BmiClient(bmi.Bmi):
Hello world
"""

occupied_ports = set()

def __init__(self, channel=None, timeout=None, stub=None):
if stub is None:
c = BmiClient.create_grpc_channel() if channel is None else channel
Expand All @@ -46,10 +44,6 @@ def create_grpc_channel(port=0, host=None):
h = "localhost"
if p == 0:
p = os.environ.get("BMI_PORT", 50051)
elif p in BmiClient.occupied_ports:
log.error("Attempt to create grpc channel on occupied port %d" % p)
return None
BmiClient.occupied_ports.add(p)
return grpc.insecure_channel(':'.join([h, str(p)]))

@staticmethod
Expand Down

0 comments on commit 6e35068

Please sign in to comment.