Exemplo n.º 1
0
        public unsafe bool Connect(Ring ring)
        {
            if (!ring.Supports(RingOperation.Connect))
            {
                // pre v5.5
                if (Socket.Connect(Addr, AddrLen))
                {
                    return(true);
                }

                // connect ongoing asynchronously until write poll completes
                WritePollDuringConnect(ring);
                return(false);
            }

            int socket = Socket;

            if (!ring.TryPrepareConnect(socket, Addr, AddrLen, AsyncOperation.ConnectOn(socket).AsUlong()))
            {
                _scheduler.ScheduleConnect(socket);
            }

            return(false);
        }
 public void ScheduleConnect(int socket)
 {
     _asyncOperationQueue.Enqueue(AsyncOperation.ConnectOn(socket));
 }