예제 #1
0
        private RemoteNode AddClient(Func <RemoteNode> fn)
        {
            RemoteNode client = null;

            try
            {
                client = fn();
                _clients.Add(client);
                return(client);
            }
            catch (Exception)
            {
                if (client != null)
                {
                    client.Dispose();
                    _clients.Remove(client);
                }
                throw;
            }
        }
예제 #2
0
 public INode ConnectTo(IPEndPoint ep)
 {
     return(AddClient(() => RemoteNode.Create(_operationTracker, ep)));
 }
예제 #3
0
 public RemoteNode ConnectTo(string address, TimeSpan connectTimeout)
 {
     return(AddClient(() => RemoteNode.Create(_operationTracker, address, connectTimeout)));
 }