Exemplo n.º 1
0
 private UntypedReceive WaitingForPrefix(IHandleEventListener el, IO.ByteString buffer)
 {
     if (buffer.Count >= 4)
     {
         var length = buffer.Iterator().GetInt();
         return WaitingForBody(el, buffer.Drop(4), length);
     }
     return message =>
     {
         if (message is Tcp.Received)
         {
             var received = message as Tcp.Received;
             Become(WaitingForPrefix(el, buffer.Concat(received.Data)));
         }
         else HandleWrite(message);
     };
 }