public Push(Ctx parent, int tid, int sid) : base(parent, tid, sid) { m_options.SocketType = ZmqSocketType.Push; lb = new LB(); }
public Router(Ctx parent, int threadId, int sid) : base(parent, threadId, sid) { m_prefetched = false; m_identitySent = false; m_moreIn = false; m_currentOut = null; m_moreOut = false; m_nextPeerId = Utils.GenerateRandom(); m_mandatory = false; m_rawSocket = false; m_options.SocketType = ZmqSocketType.Router; m_fq = new FQ(); m_prefetchedId = new Msg(); m_prefetchedMsg = new Msg(); m_anonymousPipes = new HashSet<Pipe>(); m_outpipes = new Dictionary<Blob, Outpipe>(); // TODO: Uncomment the following line when ROUTER will become true ROUTER // rather than generic router socket. // If peer disconnect there's noone to send reply to anyway. We can drop // all the outstanding requests from that peer. // options.delay_on_disconnect = false; m_options.RecvIdentity = true; }
public Req(Ctx parent, int threadId, int sid) : base(parent, threadId, sid) { m_receivingReply = false; m_messageBegins = true; m_options.SocketType = ZmqSocketType.Req; }
public Pull(Ctx parent, int threadId, int sid) : base(parent, threadId, sid) { m_options.SocketType = ZmqSocketType.Pull; m_fq = new FQ(); }
public Rep(Ctx parent, int tid, int sid) : base(parent, tid, sid) { m_sendingReply = false; m_requestBegins = true; m_options.SocketType = ZmqSocketType.Rep; }
public Sub(Ctx parent, int tid, int sid) : base(parent, tid, sid) { m_options.SocketType = ZmqSocketType.Sub; // Switch filtering messages on (as opposed to XSUB which where the // filtering is off). m_options.Filter = true; }
/// <summary> Initializes a new instance of the <see cref="Own" /> class that is running on a thread outside of 0MQ infrastructure. </summary> /// <param name="parent">The parent context.</param> /// <param name="threadId">The thread id.</param> /// <remarks> Note that the owner is unspecified in the constructor. It'll be assigned later on using <see cref="SetOwner"/> /// when the object is plugged in. </remarks> protected Own(Ctx parent, int threadId) : base(parent, threadId) { m_terminating = false; m_processedSeqnum = 0; m_owner = null; m_termAcks = 0; m_options = new Options(); }
public IOThread(Ctx ctx, int threadId) : base(ctx, threadId) { m_name = "iothread-" + threadId; m_poller = new Poller(m_name); m_mailbox = new Mailbox(m_name); m_mailboxHandle = m_mailbox.FD; m_poller.AddFD (m_mailboxHandle, this); m_poller.SetPollin (m_mailboxHandle); }
public XPub(Ctx parent, int tid, int sid) : base(parent, tid, sid) { m_options.SocketType = ZmqSocketType.Xpub; m_verbose = false; m_more = false; m_subscriptions = new Mtrie(); m_dist = new Dist(); m_pending = new Queue<Blob>(); }
public XSub(Ctx parent, int tid, int sid) : base(parent, tid, sid) { m_options.SocketType = ZmqSocketType.Xsub; m_hasMessage = false; m_more = false; m_options.Linger = 0; m_fq = new FQ(); m_dist = new Dist(); m_subscriptions = new Trie(); }
// 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>(); }
public Reaper(Ctx ctx, int threadId) : base(ctx, threadId) { m_sockets = 0; m_terminating = false; m_name = "reaper-" + threadId; m_poller = new Poller(m_name); mailbox = new Mailbox(m_name); m_mailboxHandle = mailbox.FD; m_poller.AddFD(m_mailboxHandle, this); m_poller.SetPollin(m_mailboxHandle); }
public Reaper(Ctx ctx, int threadId) : base(ctx, threadId) { m_sockets = 0; m_terminating = false; string name = "reaper-" + threadId; m_poller = new Utils.Poller(name); m_mailbox = new Mailbox(name); m_mailboxHandle = m_mailbox.Handle; m_poller.AddHandle(m_mailboxHandle, this); m_poller.SetPollin(m_mailboxHandle); }
// Holds the prefetched message. public Dealer(Ctx parent, int tid, int sid) : base(parent, tid, sid) { m_prefetched = false; m_options.SocketType = ZmqSocketType.Dealer; m_fq = new FQ(); m_lb = new LB(); // TODO: Uncomment the following line when DEALER will become true DEALER // rather than generic dealer socket. // If the socket is closing we can drop all the outbound requests. There'll // be noone to receive the replies anyway. // options.delay_on_close = false; m_options.RecvIdentity = true; }
public Stream(Ctx parent, int threadId, int sid) : base(parent, threadId, sid) { m_prefetched = false; m_identitySent = false; m_currentOut = null; m_moreOut = false; m_nextPeerId = Utils.GenerateRandom(); m_options.SocketType = ZmqSocketType.Stream; m_fq = new FQ(); m_prefetchedId = new Msg(); m_prefetchedMsg = new Msg(); m_outpipes = new Dictionary<Blob, Outpipe>(); m_options.RawSocket = true; }
protected SocketBase(Ctx parent, int threadId, int sid) : base(parent, threadId) { m_tag = 0xbaddecaf; m_ctxTerminated = false; m_destroyed = false; m_lastTsc = 0; m_ticks = 0; m_rcvMore = false; m_monitorSocket = null; m_monitorEvents = 0; m_options.SocketId = sid; m_endpoints = new Dictionary<string, Own>(); m_pipes = new List<Pipe>(); m_mailbox = new Mailbox("socket-" + sid); }
private static void CtxDestroy(Ctx ctx) { if (ctx == null || !ctx.CheckTag()) { throw NetMQException.Create(ErrorCode.EFAULT); } ctx.Terminate(); }
public static void Term(Ctx ctx) { CtxDestroy(ctx); }
// Sockets public static SocketBase Socket(Ctx ctx, ZmqSocketType type) { if (ctx == null || !ctx.CheckTag()) { throw NetMQException.Create(ErrorCode.EFAULT); } SocketBase s = ctx.CreateSocket(type); return s; }
public static void CtxSet(Ctx ctx, ContextOption option, int optval) { if (ctx == null || !ctx.CheckTag()) { throw NetMQException.Create(ErrorCode.EFAULT); } ctx.Set(option, optval); }
// New context API public static Ctx CtxNew() { // Create 0MQ context. Ctx ctx = new Ctx(); return ctx; }
protected ZObject(Ctx ctx, int tid) { this.m_ctx = ctx; this.m_tid = tid; }
private NetMQContext(Ctx ctx) { m_ctx = ctx; }
private Context(Ctx ctx) { m_ctx = ctx; }
// Create a socket of a specified type. public static SocketBase Create(ZmqSocketType type, Ctx parent, int tid, int sid) { SocketBase s; switch (type) { case ZmqSocketType.Pair: s = new Pair(parent, tid, sid); break; case ZmqSocketType.Pub: s = new Pub(parent, tid, sid); break; case ZmqSocketType.Sub: s = new Sub(parent, tid, sid); break; case ZmqSocketType.Req: s = new Req(parent, tid, sid); break; case ZmqSocketType.Rep: s = new Rep(parent, tid, sid); break; case ZmqSocketType.Dealer: s = new Dealer(parent, tid, sid); break; case ZmqSocketType.Router: s = new Router(parent, tid, sid); break; case ZmqSocketType.Pull: s = new Pull(parent, tid, sid); break; case ZmqSocketType.Push: s = new Push(parent, tid, sid); break; case ZmqSocketType.Xpub: s = new XPub(parent, tid, sid); break; case ZmqSocketType.Xsub: s = new XSub(parent, tid, sid); break; case ZmqSocketType.Stream: s = new Stream(parent, tid, sid); break; default: throw InvalidException.Create("type=" + type); } return s; }
protected void RegisterEndpoint(String addr, Ctx.Endpoint endpoint) { m_ctx.RegisterEndpoint(addr, endpoint); }
public Push(Ctx parent, int threadId, int sid) : base(parent, threadId, sid) { m_options.SocketType = ZmqSocketType.Push; lb = new LB(); }
public static int CtxGet(Ctx ctx, ContextOption option) { if (ctx == null || !ctx.CheckTag()) { throw NetMQException.Create(ErrorCode.EFAULT); } return ctx.Get(option); }
protected bool RegisterEndpoint(String addr, Ctx.Endpoint endpoint) { return m_ctx.RegisterEndpoint (addr, endpoint); }
public Pair(Ctx parent, int threadId, int sid) : base(parent, threadId, sid) { m_options.SocketType = ZmqSocketType.Pair; }
protected ZObject(Ctx ctx, int threadId) { this.m_ctx = ctx; this.m_threadId = threadId; }