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; }
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); }
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); }
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)); }
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); } }
public bool IsReplyReady(int seq) { ReplySlot slot = replies[seq]; return(slot.type == ReplySlotType.SLOT_VALUE || slot.type == ReplySlotType.SLOT_EXCEPTION); }
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; }
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); }