Changeset 332 for binary-improvements/MapRendering/Web/ConnectionHandler.cs
- Timestamp:
- Nov 16, 2018, 10:38:46 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Web/ConnectionHandler.cs
r326 r332 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Net; 3 4 4 5 namespace AllocsFixes.NetConnections.Servers.Web { … … 6 7 private readonly Dictionary<string, WebConnection> connections = new Dictionary<string, WebConnection> (); 7 8 8 public WebConnection IsLoggedIn (string _sessionId, string _endpoint) {9 public WebConnection IsLoggedIn (string _sessionId, IPAddress _ip) { 9 10 if (!connections.ContainsKey (_sessionId)) { 10 11 return null; … … 18 19 // } 19 20 20 if (con.Endpoint != _endpoint) { 21 connections.Remove (_sessionId); 21 if (!Equals (con.Endpoint, _ip)) { 22 // Fixed: Allow different clients from same NAT network 23 // connections.Remove (_sessionId); 22 24 return null; 23 25 } … … 32 34 } 33 35 34 public WebConnection LogIn (ulong _steamId, string _endpoint) {36 public WebConnection LogIn (ulong _steamId, IPAddress _ip) { 35 37 string sessionId = Guid.NewGuid ().ToString (); 36 WebConnection con = new WebConnection (sessionId, _ endpoint, _steamId);38 WebConnection con = new WebConnection (sessionId, _ip, _steamId); 37 39 connections.Add (sessionId, con); 38 40 return con; … … 40 42 41 43 public void SendLine (string line) { 42 foreach ( WebConnection wc in connections.Values) {43 wc.SendLine (line);44 foreach (KeyValuePair<string, WebConnection> kvp in connections) { 45 kvp.Value.SendLine (line); 44 46 } 45 47 }
Note:
See TracChangeset
for help on using the changeset viewer.