Skip to content

Commit

Permalink
Remove unnecessary checking of connected client for agent.
Browse files Browse the repository at this point in the history
Signed-off-by: Sergey Shilov <[email protected]>
  • Loading branch information
Sergey Shilov committed Jul 12, 2018
1 parent a1101aa commit dd1ae4c
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions indy_client/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,20 +151,8 @@ def ensureConnectedToDest(self, name, ha, clbk, *args):
name, ha, clbk, *args)

def sendMessage(self, msg, name: str = None, ha: Tuple = None):

def _send(msg):
nonlocal name, ha
self.endpoint.send(msg, name, ha)
logger.debug("Message sent (to -> {}): {}".format(ha, msg))

# TODO: if we call following isConnectedTo method by ha,
# there was a case it found more than one remote, so for now,
# I have changed it to call by remote name (which I am not sure
# fixes the issue), need to come back to this.
if not self.endpoint.isConnectedTo(name=name, ha=ha):
self.ensureConnectedToDest(name, ha, _send, msg)
else:
_send(msg)
self.endpoint.send(msg, name, ha)
logger.debug("Message sent (to -> {}): {}".format(ha, msg))

def registerEventListener(self, eventName, listener):
cur = self._eventListeners.get(eventName)
Expand Down

0 comments on commit dd1ae4c

Please sign in to comment.