Exemplo n.º 1
0
 public override byte[] Freeze()
 {
     lock (Sync)
     {
         _Incoming  = null; _Outgoing = null; Frozen = true;
         gotReqHead = gotReqBody = gotResHead = hasResBody = false;
         Base.Unpipe();
         IncomingHead.Unpipe();
         IncomingHead.OnFail -= OnSegmentFail;
         if (!gotReqHead)
         {
             IncomingHead.OnCollect -= PushIncoming;
         }
         IncomingBody.Unpipe();
         IncomingBody.Excess.Unpipe();
         IncomingBody.OnFail -= OnSegmentFail;
         if (!gotReqBody)
         {
             IncomingBody.OnFinish -= FinishIncomingMessage;
         }
         OutgoingHead.Unpipe();
         OutgoingHead.OnFail -= OnSegmentFail;
         OutgoingBody.Unpipe();
         OutgoingBody.OnFail -= OnSegmentFail;
         if (!hasResBody)
         {
             OutgoingBody.OnFinish -= FinishOutgoingMessage;
         }
         return(excess.Read());
     }
 }
Exemplo n.º 2
0
 public override bool FinishOutgoing()
 {
     lock (Sync)
     {
         if (!gotResHead)
         {
             return(false);
         }
         OutgoingBody.OnFinish -= FinishOutgoingMessage;
         if (!OutgoingBody.Finished)
         {
             OutgoingBody.Finish();
         }
         OutgoingBody.Unpipe();
         _Outgoing.Finish();
         _Incoming = null;
         _Outgoing = null;
         WaitIncoming();
         return(!(hasResBody = false));
     }
 }