Exemple #1
0
 /// <summary>
 /// If the tunnel is connected, a new AnpTransport is created and the
 /// method returns true. Otherwise, the method returns false.
 /// </summary>
 public bool CheckConnect()
 {
     SelectSockets select = new SelectSockets();
     select.Timeout = 0;
     select.AddRead(tunnel.Sock);
     tunnel.CheckTls();
     select.Select();
     if (select.ReadSockets.Contains(tunnel.Sock))
     {
         CreateTransport();
         return true;
     }
     return false;
 }
Exemple #2
0
 /// <summary>
 /// Wait for one of the sockets specified to become ready, for a message
 /// to arrive or for the thread to be cancelled. Be careful not to call
 /// Block() while handling a message, since this method does not handle
 /// recursivity. Do not call this method after it has thrown an exception.
 /// </summary>
 protected void Block(SelectSockets set)
 {
     Debug.Assert(!BlockedFlag);
     BlockedFlag = true;
     set.AddRead(SocketPair[1]);
     set.Select();
     FlushWakeUp();
     CheckCancellation();
     CheckMessages();
     BlockedFlag = false;
 }