internal UdpConnection(UdpSocket s, UdpConnectionMode m, UdpEndPoint ep) { socket = s; mode = m; endpoint = ep; stats = new UdpStats(); networkRtt = socket.Config.DefaultNetworkPing; aliasedRtt = socket.Config.DefaultAliasedPing; mtu = socket.Config.PacketSize; alwaysSendMtu = socket.Config.DefaultAlwaysSendMtu; state = UdpConnectionState.Connecting; recvTime = socket.GetCurrentTime(); sendTime = recvTime; sendWindow = new UdpRingBuffer <UdpHandle>(socket.Config.PacketWindow); this.networkPingFilterRttValues = new uint[socket.Config.NetworkPingMedianFilterSize]; this.networkPingFilterSortedIndices = new int[socket.Config.NetworkPingMedianFilterSize]; for (int i = 0; i < this.networkPingFilterSortedIndices.Length; ++i) { this.networkPingFilterSortedIndices[i] = i; } networkPingFilterNextIndexToReplace = 0; serializer = socket.CreateSerializer(); serializer.Connection = this; }
UdpConnection CreateConnection(UdpEndPoint endpoint, UdpConnectionMode mode) { if (connLookup.ContainsKey(endpoint)) { UdpLog.Warn("connection for {0} already exists", endpoint); return(default(UdpConnection)); } UdpConnection cn = new UdpConnection(this, mode, endpoint); connLookup.Add(endpoint, cn); connList.Add(cn); return(cn); }
internal UdpConnection(UdpSocket sock, UdpConnectionMode m, UdpEndPoint ep) { socket = sock; mode = m; endpoint = ep; networkRtt = socket.Config.DefaultNetworkPing; aliasedRtt = socket.Config.DefaultAliasedPing; mtu = sock.Config.DefaultMtu; alwaysSendMtu = sock.Config.DefaultAlwaysSendMtu; serializer = sock.CreateSerializer(); state = UdpConnectionState.Connecting; recvTime = socket.GetCurrentTime(); sendTime = recvTime; stats = new UdpConnectionStats(); sendWindow = new UdpRingBuffer <UdpHandle>(sock.Config.PacketWindow); }
internal UdpConnection(UdpSocket sock, UdpConnectionMode m, UdpEndPoint ep) { socket = sock; mode = m; endpoint = ep; networkRtt = socket.Config.DefaultNetworkPing; aliasedRtt = socket.Config.DefaultAliasedPing; mtu = sock.Config.DefaultMtu; alwaysSendMtu = sock.Config.DefaultAlwaysSendMtu; serializer = sock.CreateSerializer(); state = UdpConnectionState.Connecting; recvTime = socket.GetCurrentTime(); sendTime = recvTime; stats = new UdpConnectionStats(); sendWindow = new UdpRingBuffer<UdpHandle>(sock.Config.PacketWindow); }
internal UdpConnection(UdpSocket s, UdpConnectionMode m, UdpEndPoint ep) { socket = s; mode = m; endpoint = ep; stats = new UdpStats(); networkRtt = socket.Config.DefaultNetworkPing; aliasedRtt = socket.Config.DefaultAliasedPing; mtu = socket.Config.PacketSize; alwaysSendMtu = socket.Config.DefaultAlwaysSendMtu; state = UdpConnectionState.Connecting; recvTime = socket.GetCurrentTime(); sendTime = recvTime; sendWindow = new UdpRingBuffer<UdpHandle>(socket.Config.PacketWindow); this.networkPingFilterRttValues = new uint[socket.Config.NetworkPingMedianFilterSize]; this.networkPingFilterSortedIndices = new int[socket.Config.NetworkPingMedianFilterSize]; for (int i = 0; i < this.networkPingFilterSortedIndices.Length; ++i) { this.networkPingFilterSortedIndices[i] = i; } networkPingFilterNextIndexToReplace = 0; serializer = socket.CreateSerializer(); serializer.Connection = this; }