Task OnAcceptClientCommandAsync(ListenerCommand.AcceptCommand acceptCommand) { string id = acceptCommand.Id; var trackingContext = TrackingContext.Create(id, this.Address); #if DEBUG // TestHook: In DEBUG builds if the trackingId is Guid.Empty don't accept the rendezvous if (trackingContext.TrackingId.StartsWith(Guid.Empty.ToString(), StringComparison.Ordinal)) { return(TaskEx.CompletedTask); } #endif RelayEventSource.Log.RelayListenerRendezvousStart(this.ToString(), trackingContext.TrackingId, acceptCommand.Address); DataConnection clientConnection; lock (this.ThisLock) { if (this.closeCalled) { RelayEventSource.Log.RelayListenerRendezvousFailed(this.ToString(), trackingContext.TrackingId, SR.ObjectClosedOrAborted); return(TaskEx.CompletedTask); } else if (this.clientConnections.ContainsKey(id)) { RelayEventSource.Log.RelayListenerRendezvousFailed(this.ToString(), trackingContext.TrackingId, SR.DuplicateConnectionId); return(TaskEx.CompletedTask); } clientConnection = new DataConnection(this, acceptCommand, trackingContext); this.clientConnections.Add(id, clientConnection); } return(clientConnection.AcceptConnectionAsync()); }