예제 #1
0
        public NodeConnection ConnectNode(string nodeId, string connectionId)
        {
            if (!IsConnected(nodeId))
            {
                //If there is only one bout running, add new nodes to it
                //Otherwise do not assign a bout (Guid.Empty)
                var running = _boutRunnerService.RunningBouts();
                var boutId  = running.Count == 1 ? running.Single().BoutId : Guid.Empty;

                _nodeIdToConnectionId[nodeId] = new NodeConnection
                {
                    BoutId           = boutId,
                    NodeId           = nodeId,
                    ConnectionNumber = NextConnectionNumber(),
                    Roles            = new List <string>()
                };
            }

            _nodeIdToConnectionId[nodeId].ConnectionId = connectionId;

            return(_nodeIdToConnectionId[nodeId]);
        }
예제 #2
0
 public List <RunningBout> Running()
 {
     return(_boutRunnerService.RunningBouts());
 }