private void DoVerfifyAccountResult(BL_VerifyAccountResult msg, PBChannel channel, int src, uint seq) { uint msgId = MessageMapping.Query(typeof(LB_VerifyAccount)); string timeoutKey = string.Format("{0}:{1}", msgId, msg.Account); m_VerifyAccountWatch.Remove(timeoutKey); VerifyAccountCB cb = m_VerifyAccountTimeout.Get(timeoutKey); if (cb != null) { cb(msg.Account, msg.Result, msg.AccountId); m_VerifyAccountTimeout.Remove(timeoutKey); } }
public void VerifyAccount(string account, int opcode, int channelId, string data, VerifyAccountCB cb) { uint msgId = MessageMapping.Query(typeof(LB_VerifyAccount)); string timeoutKey = string.Format("{0}:{1}", msgId, account); if (m_VerifyAccountWatch.Exists(timeoutKey)) { cb(account, false, ""); } else { LB_VerifyAccount.Builder builder = LB_VerifyAccount.CreateBuilder(); builder.Account = account; builder.OpCode = opcode; builder.ChannelId = channelId; builder.Data = data; if (!channel_.Send(builder.Build())) { cb(account, false, ""); } else { m_VerifyAccountWatch.Add(timeoutKey); m_VerifyAccountTimeout.Set(timeoutKey, cb, () => cb.Invoke(account, false, "")); } } }