private Dictionary <uint, UdpClientSession> dict = new Dictionary <uint, UdpClientSession>(); //conv - UdpClientSession public UdpClientSession CreateSession(uint conv, IUdpMsgHandler _handler, Socket sendSocket, IPEndPoint remoteIEP, long heartBeatTime) { UdpClientSession session = new UdpClientSession(conv, sendSocket, remoteIEP, _handler, heartBeatTime); dict[session.GetConv()] = session; Log.InfoAf("[Udp] UdpClientSessionMgr Conv={0} Add UdpClientSession RemoteIp ={1} RemotePort = {2}", conv, session.GetRemoteIp(), session.GetRemotePort()); return(session); }
private void ProcessClientKcpMsg(IUdpEvent evt) { UdpClientReceiver receiver = evt.GetUdpReceiver() as UdpClientReceiver; if (receiver == null) { return; } UdpClientSession session = receiver.GetUdpClientSessionMgr().FindSession(evt.GetConv()); if (session == null) { Log.WarnAf("[Udp] UdpClientReceiver Conv = {0} Not Exist", evt.GetConv()); } else if (evt.GetConv() == session.GetConv()) { session.KcpInput(evt.GetMessage()); } }
public void DelSession(uint conv) { if (dict.ContainsKey(conv)) { UdpClientSession session = dict[conv]; Log.InfoAf("[Udp] UdpClientSessionMgr Del Conv ={0} UdpSession RemoteIp ={1} RemotePort = {2}", session.GetConv(), session.GetRemoteIp(), session.GetRemotePort()); dict.Remove(conv); } }