Ejemplo n.º 1
0
 public KVReply(IKVMessage query, Stopwatch chrono, KVReplyCallback callback = null)
 {
     Query           = query;
     Answer          = KVAnswer.Pong;
     msElapsed_start = chrono.ElapsedMilliseconds;
     SendTime        = DateTime.Now;
     RoundTripTime   = TimeSpan.Zero;
     Callback        = callback;
 }
Ejemplo n.º 2
0
 public async Task <int> SendAsync(IKVMessage query, KVReplyCallback callback = null)
 {
     lock (lockObject)
     {
         query.Id = ++MsgId;
         SendAsync(query.Message, 0, query.MessageLength).Wait();
         var reply = new KVReply(query, chrono, callback);
         ReplyQueue[reply.Id] = reply;
         Logger.Log(LogLevel.Debug, ">> query enqueue : id={0}, len={1}, mode={2}", query.Id, query.MessageLength, query.Mode);
         return(query.Id);
     }
 }