Beispiel #1
0
        //  Note that the owner is unspecified in the constructor.
        //  It'll be supplied later on when the object is plugged in.
        //  The object is not living within an I/O thread. It has it's own
        //  thread outside of 0MQ infrastructure.
        public Own(Ctx parent, int tid)
            : base(parent, tid)
        {
            m_terminating = false;
            m_sentSeqnum = new AtomicLong(0);
            m_processedSeqnum = 0;
            m_owner = null;
            m_termAcks = 0;

            m_options = new Options();
            owned = new HashSet<Own>();
        }
Beispiel #2
0
        //  The object is living within I/O thread.
        public Own(IOThread ioThread, Options options)
            : base(ioThread)
        {
            m_options = options;
            m_terminating = false;
            m_sentSeqnum = new AtomicLong(0);
            m_processedSeqnum = 0;
            m_owner = null;
            m_termAcks = 0;

            owned = new HashSet<Own>();
        }
Beispiel #3
0
        public TcpConnecter(IOThread ioThread,
            SessionBase session, Options options,
            Address addr, bool delayedStart)
            : base(ioThread, options)
        {
            m_ioObject = new IOObject(ioThread);
            m_addr = addr;
            m_handle = null;
            m_handleValid = false;
            m_delayedStart = delayedStart;
            m_timerStarted = false;
            m_session = session;
            m_currentReconnectIvl = m_options.ReconnectIvl;

            Debug.Assert(m_addr != null);
            m_endpoint = m_addr.ToString();
            m_socket = session.Socket;
        }
Beispiel #4
0
        public SessionBase(IOThread ioThread, bool connect,
            SocketBase socket, Options options, Address addr)
            : base(ioThread, options)
        {
            m_ioObject = new IOObject(ioThread);

            m_connect = connect;
            m_pipe = null;
            m_incompleteIn = false;
            m_pending = false;
            m_engine = null;
            m_socket = socket;
            m_ioThread = ioThread;
            m_hasLingerTimer = false;
            m_identitySent = false;
            m_identityReceived = false;
            m_addr = addr;

            m_terminatingPipes = new HashSet <Pipe> ();
        }
Beispiel #5
0
 public RouterSession(IOThread ioThread, bool connect,
     SocketBase socket, Options options,
     Address addr)
     : base(ioThread, connect, socket, options, addr)
 {
 }
Beispiel #6
0
 public IpcListener(IOThread ioThread, SocketBase socket, Options options)
     : base(ioThread, socket, options)
 {
     m_address = new IpcAddress();
 }
Beispiel #7
0
 public ReqSession(IOThread ioThread, bool connect,
     SocketBase socket, Options options,
     Address addr)
     : base(ioThread, connect, socket, options, addr)
 {
     m_state = State.Identity;
 }
Beispiel #8
0
        public static SessionBase Create(IOThread ioThread, bool connect,
            SocketBase socket, Options options, Address addr)
        {
            SessionBase s;
            switch (options.SocketType) {
                case ZmqSocketType.Req:
                    s = new  Req.ReqSession (ioThread, connect,
                                             socket, options, addr);
                    break;
                case ZmqSocketType.Dealer:
                    s = new Dealer.DealerSession (ioThread, connect,
                                                  socket, options, addr);
                    break;
                case ZmqSocketType.Rep:
                    s = new Rep.RepSession (ioThread, connect,
                                            socket, options, addr);
                    break;
                case ZmqSocketType.Router:
                    s = new Router.RouterSession (ioThread, connect,
                                                  socket, options, addr);
                    break;
                case ZmqSocketType.Pub:
                    s = new Pub.PubSession (ioThread, connect,
                                            socket, options, addr);
                    break;
                case ZmqSocketType.Xpub:
                    s = new XPub.XPubSession(ioThread, connect,
                                             socket, options, addr);
                    break;
                case ZmqSocketType.Sub:
                    s = new  Sub.SubSession (ioThread, connect,
                                             socket, options, addr);
                    break;
                case ZmqSocketType.Xsub:
                    s = new XSub.XSubSession (ioThread, connect,
                                              socket, options, addr);
                    break;

                case ZmqSocketType.Push:
                    s = new Push.PushSession (ioThread, connect,
                                              socket, options, addr);
                    break;
                case ZmqSocketType.Pull:
                    s = new Pull.PullSession (ioThread, connect,
                                              socket, options, addr);
                    break;
                case ZmqSocketType.Pair:
                    s = new Pair.PairSession (ioThread, connect,
                                              socket, options, addr);
                    break;
                default:
                    throw new ArgumentException("type=" + options.SocketType);
            }
            return s;
        }
Beispiel #9
0
 public Endpoint(SocketBase socket, Options options)
 {
     Socket = socket;
     Options = options;
 }
Beispiel #10
0
        public StreamEngine(Socket fd, Options options, String endpoint)
        {
            m_handle = fd;
            //      inbuf = null;
            m_insize = 0;
            m_inputError = false;
            //        outbuf = null;
            m_outsize = 0;
            m_handshaking = true;
            m_session = null;
            m_options = options;
            m_plugged = false;
            m_endpoint = endpoint;
            m_socket = null;
            m_encoder = null;
            m_decoder = null;

            //  Put the socket into non-blocking mode.
            Utils.UnblockSocket(m_handle);

            //  Set the socket buffer limits for the underlying socket.
            if (m_options.SendBuffer != 0)
            {
                m_handle.SendBufferSize = m_options.SendBuffer;
            }
            if (m_options.ReceiveBuffer != 0)
            {
                m_handle.ReceiveBufferSize = m_options.ReceiveBuffer;
            }
        }