public void DelSession(int iepHashCode) { if (dict.ContainsKey(iepHashCode)) { UdpServerSession session = dict[iepHashCode]; usedConvList.Remove(session.GetConv()); freeConvQueue.Enqueue(session.GetConv()); Log.InfoAf("[Udp] UdpServer Del UdpSession ServerId={0} IepHashCode={1} Conv = {2} RemoteIp ={3} RemotePort = {4}", serverId, session.GetIepHashCode(), session.GetConv(), session.GetRemoteIp(), session.GetRemotePort()); dict.Remove(iepHashCode); } }
public UdpServerSession CreateSession(Socket sendSocket, IPEndPoint remoteIEP) { uint conv = PopFreeConv(); if (conv == 0) { return(null); } usedConvList.Add(conv); UdpServerSession session = new UdpServerSession(serverId, conv, sendSocket, remoteIEP, handler, maxHeartBeatTime); dict[session.GetIepHashCode()] = session; Log.InfoAf("[Udp] UdpServer Add UdpSession ServerId={0} IepHashCode={1} Conv = {2} RemoteIp ={3} RemotePort = {4}", serverId, session.GetIepHashCode(), session.GetConv(), session.GetRemoteIp(), session.GetRemotePort()); return(session); }