Exemplo n.º 1
0
 private async Task HandleIncomingAsync(ITransportChannelOpenHeader header, ChannelMessage message)
 {
     using (message)
     {
         if (_sendCompletion.IsEntered)
         {
             _log.Trace("Skipping message because termination is in progress: {0}", header);
             return;
         }
         TransportChannel channel;
         lock (_channels)
         {
             if (_channels.ContainsKey(header.ChannelId))
             {
                 _log.Trace("Skipping message because the specified channel already exists: {0}", header);
                 return;
             }
             _log.Trace("Creating new channel by remote request: {0}", header);
             channel = new TransportChannel(Id, header.ChannelId, _transportSendProcessor.Out, _headerFactory);
             _channels[channel.Id] = channel;
             channel.Completion.ContinueWithSynchronously((Action <Task, object>)OnChannelCompleted, channel).IgnoreAwait(_log);
         }
         await _incomingChannelQueue.Out.WriteAsync(channel).ConfigureAwait(false);
     }
 }
Exemplo n.º 2
0
 public IPooledBuffer Handle(ITransportChannelOpenHeader header, Nothing _)
 {
     using (var headerProto = Header.Rent())
         using (var channelOpenProto = ChannelOpenHeader.Rent())
         {
             headerProto.ChannelOpen = MergeToProto(channelOpenProto, header);
             return(headerProto.Serialize());
         }
 }
 public T Handle(ITransportChannelOpenHeader header, TArgs args)
 {
     return(_openHandler(header, args));
 }
Exemplo n.º 4
0
 private static ChannelOpenHeader MergeToProto(ChannelOpenHeader proto, ITransportChannelOpenHeader messageHeader)
 {
     proto           = proto ?? new ChannelOpenHeader();
     proto.ChannelId = proto.ChannelId.MergeFrom(messageHeader.ChannelId);
     return(proto);
 }
Exemplo n.º 5
0
 private static Task HandleIncomingAsync(ITransportChannelOpenHeader header, ChannelMessage message)
 {
     return(TaskConstants.Completed);
 }
Exemplo n.º 6
0
 public Maybe <int> Handle(ITransportChannelOpenHeader header, Nothing _)
 {
     return(Nothing.Instance);
 }