Beispiel #1
0
 /** normal connected state */
 private Receive Connected(ConnectionInfo info)
 {
     return(message =>
     {
         if (HandleWriteMessages(info)(message))
         {
             return true;
         }
         if (message is Tcp.SuspendReading)
         {
             SuspendReading(info);
             return true;
         }
         if (message is Tcp.ResumeReading)
         {
             ResumeReading(info);
             return true;
         }
         if (message is SelectionHandler.ChannelReadable)
         {
             DoRead(info, null);
             return true;
         }
         var cmd = message as Tcp.CloseCommand;
         if (cmd != null)
         {
             HandleClose(info, Sender, cmd.Event);
         }
         return false;
     });
 }
Beispiel #2
0
 /** the peer sent EOF first, but we may still want to send */
 private Receive PeerSentEOF(ConnectionInfo info)
 {
     return(message =>
     {
         if (HandleWriteMessages(info)(message))
         {
             return true;
         }
         var cmd = message as Tcp.CloseCommand;
         if (cmd != null)
         {
             HandleClose(info, Sender, cmd.Event);
             return true;
         }
         return false;
     });
 }