Beispiel #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;
            }
        }
Beispiel #2
0
 public INode ConnectTo(IPEndPoint ep)
 {
     return(AddClient(() => RemoteNode.Create(_operationTracker, ep)));
 }
Beispiel #3
0
 public RemoteNode ConnectTo(string address, TimeSpan connectTimeout)
 {
     return(AddClient(() => RemoteNode.Create(_operationTracker, address, connectTimeout)));
 }