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; }
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); } }