private void SetConnectionClientData(ConnectionClientData connectionClientData, ClientId id) { if (!Server.Clients.TryGetValue(id, out var client)) { return; } client.ConnectionData = connectionClientData; }
public void UpdateClientConnectionInfo(ClientConnectionInfo msg) { var obj = new ConnectionClientData(); obj.ClientAddress = AddressFun(msg); obj.Ping = msg.Ping; obj.PingDeviation = msg.PingDeviation; obj.ConnectedTime = msg.ConnectedTime; obj.PacketsSentSpeech = msg.PacketsSentSpeech; obj.PacketsSentKeepalive = msg.PacketsSentKeepalive; obj.PacketsSentControl = msg.PacketsSentControl; obj.BytesSentSpeech = msg.BytesSentSpeech; obj.BytesSentKeepalive = msg.BytesSentKeepalive; obj.BytesSentControl = msg.BytesSentControl; obj.PacketsReceivedSpeech = msg.PacketsReceivedSpeech; obj.PacketsReceivedKeepalive = msg.PacketsReceivedKeepalive; obj.PacketsReceivedControl = msg.PacketsReceivedControl; obj.BytesReceivedSpeech = msg.BytesReceivedSpeech; obj.BytesReceivedKeepalive = msg.BytesReceivedKeepalive; obj.BytesReceivedControl = msg.BytesReceivedControl; obj.ServerToClientPacketlossSpeech = msg.ServerToClientPacketlossSpeech; obj.ServerToClientPacketlossKeepalive = msg.ServerToClientPacketlossKeepalive; obj.ServerToClientPacketlossControl = msg.ServerToClientPacketlossControl; obj.ServerToClientPacketlossTotal = msg.ServerToClientPacketlossTotal; obj.ClientToServerPacketlossSpeech = msg.ClientToServerPacketlossSpeech; obj.ClientToServerPacketlossKeepalive = msg.ClientToServerPacketlossKeepalive; obj.ClientToServerPacketlossControl = msg.ClientToServerPacketlossControl; obj.ClientToServerPacketlossTotal = msg.ClientToServerPacketlossTotal; obj.BandwidthSentLastSecondSpeech = msg.BandwidthSentLastSecondSpeech; obj.BandwidthSentLastSecondKeepalive = msg.BandwidthSentLastSecondKeepalive; obj.BandwidthSentLastSecondControl = msg.BandwidthSentLastSecondControl; obj.BandwidthSentLastMinuteSpeech = msg.BandwidthSentLastMinuteSpeech; obj.BandwidthSentLastMinuteKeepalive = msg.BandwidthSentLastMinuteKeepalive; obj.BandwidthSentLastMinuteControl = msg.BandwidthSentLastMinuteControl; obj.BandwidthReceivedLastSecondSpeech = msg.BandwidthReceivedLastSecondSpeech; obj.BandwidthReceivedLastSecondKeepalive = msg.BandwidthReceivedLastSecondKeepalive; obj.BandwidthReceivedLastSecondControl = msg.BandwidthReceivedLastSecondControl; obj.BandwidthReceivedLastMinuteSpeech = msg.BandwidthReceivedLastMinuteSpeech; obj.BandwidthReceivedLastMinuteKeepalive = msg.BandwidthReceivedLastMinuteKeepalive; obj.BandwidthReceivedLastMinuteControl = msg.BandwidthReceivedLastMinuteControl; obj.FiletransferBandwidthSent = msg.FiletransferBandwidthSent; obj.FiletransferBandwidthReceived = msg.FiletransferBandwidthReceived; obj.IdleTime = msg.IdleTime; SetConnectionClientData(obj, msg.ClientId); }
public void UpdateClientConnectionInfo(ClientConnectionInfo msg) { var obj = new ConnectionClientData(); { var tmpv = AddressFun(msg); if (tmpv != null) { obj.ClientAddress = (SocketAddr)tmpv; } } { var tmpv = msg.Ping; if (tmpv != null) { obj.Ping = (Duration)tmpv; } } { var tmpv = msg.PingDeviation; if (tmpv != null) { obj.PingDeviation = (Duration)tmpv; } } { var tmpv = msg.ConnectedTime; if (tmpv != null) { obj.ConnectedTime = (Duration)tmpv; } } { var tmpv = msg.PacketsSentSpeech; if (tmpv != null) { obj.PacketsSentSpeech = (u64)tmpv; } } { var tmpv = msg.PacketsSentKeepalive; if (tmpv != null) { obj.PacketsSentKeepalive = (u64)tmpv; } } { var tmpv = msg.PacketsSentControl; if (tmpv != null) { obj.PacketsSentControl = (u64)tmpv; } } { var tmpv = msg.BytesSentSpeech; if (tmpv != null) { obj.BytesSentSpeech = (u64)tmpv; } } { var tmpv = msg.BytesSentKeepalive; if (tmpv != null) { obj.BytesSentKeepalive = (u64)tmpv; } } { var tmpv = msg.BytesSentControl; if (tmpv != null) { obj.BytesSentControl = (u64)tmpv; } } { var tmpv = msg.PacketsReceivedSpeech; if (tmpv != null) { obj.PacketsReceivedSpeech = (u64)tmpv; } } { var tmpv = msg.PacketsReceivedKeepalive; if (tmpv != null) { obj.PacketsReceivedKeepalive = (u64)tmpv; } } { var tmpv = msg.PacketsReceivedControl; if (tmpv != null) { obj.PacketsReceivedControl = (u64)tmpv; } } { var tmpv = msg.BytesReceivedSpeech; if (tmpv != null) { obj.BytesReceivedSpeech = (u64)tmpv; } } { var tmpv = msg.BytesReceivedKeepalive; if (tmpv != null) { obj.BytesReceivedKeepalive = (u64)tmpv; } } { var tmpv = msg.BytesReceivedControl; if (tmpv != null) { obj.BytesReceivedControl = (u64)tmpv; } } { var tmpv = msg.ServerToClientPacketlossSpeech; if (tmpv != null) { obj.ServerToClientPacketlossSpeech = (f32)tmpv; } } { var tmpv = msg.ServerToClientPacketlossKeepalive; if (tmpv != null) { obj.ServerToClientPacketlossKeepalive = (f32)tmpv; } } { var tmpv = msg.ServerToClientPacketlossControl; if (tmpv != null) { obj.ServerToClientPacketlossControl = (f32)tmpv; } } { var tmpv = msg.ServerToClientPacketlossTotal; if (tmpv != null) { obj.ServerToClientPacketlossTotal = (f32)tmpv; } } { var tmpv = msg.ClientToServerPacketlossSpeech; if (tmpv != null) { obj.ClientToServerPacketlossSpeech = (f32)tmpv; } } { var tmpv = msg.ClientToServerPacketlossKeepalive; if (tmpv != null) { obj.ClientToServerPacketlossKeepalive = (f32)tmpv; } } { var tmpv = msg.ClientToServerPacketlossControl; if (tmpv != null) { obj.ClientToServerPacketlossControl = (f32)tmpv; } } { var tmpv = msg.ClientToServerPacketlossTotal; if (tmpv != null) { obj.ClientToServerPacketlossTotal = (f32)tmpv; } } { var tmpv = msg.BandwidthSentLastSecondSpeech; if (tmpv != null) { obj.BandwidthSentLastSecondSpeech = (u64)tmpv; } } { var tmpv = msg.BandwidthSentLastSecondKeepalive; if (tmpv != null) { obj.BandwidthSentLastSecondKeepalive = (u64)tmpv; } } { var tmpv = msg.BandwidthSentLastSecondControl; if (tmpv != null) { obj.BandwidthSentLastSecondControl = (u64)tmpv; } } { var tmpv = msg.BandwidthSentLastMinuteSpeech; if (tmpv != null) { obj.BandwidthSentLastMinuteSpeech = (u64)tmpv; } } { var tmpv = msg.BandwidthSentLastMinuteKeepalive; if (tmpv != null) { obj.BandwidthSentLastMinuteKeepalive = (u64)tmpv; } } { var tmpv = msg.BandwidthSentLastMinuteControl; if (tmpv != null) { obj.BandwidthSentLastMinuteControl = (u64)tmpv; } } { var tmpv = msg.BandwidthReceivedLastSecondSpeech; if (tmpv != null) { obj.BandwidthReceivedLastSecondSpeech = (u64)tmpv; } } { var tmpv = msg.BandwidthReceivedLastSecondKeepalive; if (tmpv != null) { obj.BandwidthReceivedLastSecondKeepalive = (u64)tmpv; } } { var tmpv = msg.BandwidthReceivedLastSecondControl; if (tmpv != null) { obj.BandwidthReceivedLastSecondControl = (u64)tmpv; } } { var tmpv = msg.BandwidthReceivedLastMinuteSpeech; if (tmpv != null) { obj.BandwidthReceivedLastMinuteSpeech = (u64)tmpv; } } { var tmpv = msg.BandwidthReceivedLastMinuteKeepalive; if (tmpv != null) { obj.BandwidthReceivedLastMinuteKeepalive = (u64)tmpv; } } { var tmpv = msg.BandwidthReceivedLastMinuteControl; if (tmpv != null) { obj.BandwidthReceivedLastMinuteControl = (u64)tmpv; } } { var tmpv = msg.FiletransferBandwidthSent; if (tmpv != null) { obj.FiletransferBandwidthSent = (u64)tmpv; } } { var tmpv = msg.FiletransferBandwidthReceived; if (tmpv != null) { obj.FiletransferBandwidthReceived = (u64)tmpv; } } { var tmpv = msg.IdleTime; if (tmpv != null) { obj.IdleTime = (Duration)tmpv; } } SetConnectionClientData(obj, msg.ClientId); }