Пример #1
1
 public int BeginCall(int funcid, Packers.AbstractPacker packer)
 {
     int seq = getSeq ();
     transport.BeginWrite (seq);
     Packers.Int8.pack (CMD_INVOKE, transport);
     Packers.Int32.pack (funcid, transport);
     replies[seq] = new ReplySlot (packer);
     return seq;
 }
Пример #2
0
            public int Ping(string payload, int msecs)
            {
                DateTime t0  = DateTime.Now;
                int      seq = getSeq();

                transport.BeginWrite(seq);
                Packers.Int8.pack(CMD_PING, transport);
                Packers.Str.pack(payload, transport);
                transport.EndWrite();
                replies[seq] = new ReplySlot(Packers.Str);
                string reply;

                try {
                    reply = (string)GetReply(seq, msecs);
                } catch (TimeoutException ex) {
                    DiscardReply(seq);
                    throw ex;
                }
                TimeSpan dt = DateTime.Now - t0;

                if (reply != payload)
                {
                    throw new ProtocolError("reply does not match payload!");
                }
                return(dt.Milliseconds);
            }
Пример #3
0
            public int BeginCall(int funcid, Packers.AbstractPacker packer)
            {
                int seq = getSeq();

                transport.BeginWrite(seq);
                Packers.Int8.pack(CMD_INVOKE, transport);
                Packers.Int32.pack(funcid, transport);
                replies[seq] = new ReplySlot(packer);
                return(seq);
            }
Пример #4
0
            public HeteroMap GetServiceInfo(int code)
            {
                int seq = getSeq();

                transport.BeginWrite(seq);
                Packers.Int8.pack(CMD_GETINFO, transport);
                Packers.Int32.pack(code, transport);
                transport.EndWrite();
                replies[seq] = new ReplySlot(Packers.builtinHeteroMapPacker);
                return((HeteroMap)GetReply(seq));
            }
Пример #5
0
            public Object GetReply(int seq, int msecs)
            {
                ReplySlot slot = WaitReply(seq, msecs);

                if (slot.type == ReplySlotType.SLOT_VALUE)
                {
                    return(slot.value);
                }
                else if (slot.type == ReplySlotType.SLOT_EXCEPTION)
                {
                    throw (Exception)slot.value;
                }
                else
                {
                    throw new ApplicationException("invalid slot type: " + slot.type);
                }
            }
Пример #6
0
            public bool IsReplyReady(int seq)
            {
                ReplySlot slot = replies[seq];

                return(slot.type == ReplySlotType.SLOT_VALUE || slot.type == ReplySlotType.SLOT_EXCEPTION);
            }
Пример #7
0
 public int Ping(string payload, int msecs)
 {
     DateTime t0 = DateTime.Now;
     int seq = getSeq ();
     transport.BeginWrite (seq);
     Packers.Int8.pack (CMD_PING, transport);
     Packers.Str.pack (payload, transport);
     transport.EndWrite ();
     replies[seq] = new ReplySlot (Packers.Str);
     string reply;
     try {
         reply = (string)GetReply (seq, msecs);
     } catch (TimeoutException ex) {
         DiscardReply (seq);
         throw ex;
     }
     TimeSpan dt = DateTime.Now - t0;
     if (reply != payload) {
         throw new ProtocolError ("reply does not match payload!");
     }
     return dt.Milliseconds;
 }
Пример #8
0
 public HeteroMap GetServiceInfo(int code)
 {
     int seq = getSeq ();
     transport.BeginWrite (seq);
     Packers.Int8.pack (CMD_GETINFO, transport);
     Packers.Int32.pack (code, transport);
     transport.EndWrite ();
     replies[seq] = new ReplySlot (Packers.builtinHeteroMapPacker);
     return (HeteroMap)GetReply (seq);
 }