forked from hyperledger/indy-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagent_net.py
28 lines (26 loc) · 1.16 KB
/
agent_net.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from sovrin_client.agent.endpoint import REndpoint, ZEndpoint
class AgentNet:
"""
Mixin for Agents to encapsulate the network interface to communicate with
other agents.
"""
def __init__(self, name, port, msgHandler, config, basedirpath=None,
endpoint_args=None):
if port:
if config.UseZStack:
endpoint_args = endpoint_args or {}
seed = endpoint_args.get('seed')
onlyListener = endpoint_args.get('onlyListener', False)
self.endpoint = ZEndpoint(port=port,
msgHandler=msgHandler,
name=name,
basedirpath=basedirpath,
seed=seed,
onlyListener=onlyListener)
else:
self.endpoint = REndpoint(port=port,
msgHandler=msgHandler,
name=name,
basedirpath=basedirpath)
else:
self.endpoint = None