diff options
| author | Michael VanOverbeek <[email protected]> | 2017-05-21 12:21:41 +0000 |
|---|---|---|
| committer | Michael VanOverbeek <[email protected]> | 2017-05-21 12:21:41 +0000 |
| commit | 31cc9148dd23737df16d8456a42d003cd31dd488 (patch) | |
| tree | f699644cd0384e80a673099374649b7350d6e02d /ShiftOS_TheReturn/ServerManager.cs | |
| parent | 3b1c71e6710c06a9e390f449589bd30cb2f4b7dd (diff) | |
| download | shiftos_thereturn-31cc9148dd23737df16d8456a42d003cd31dd488.tar.gz shiftos_thereturn-31cc9148dd23737df16d8456a42d003cd31dd488.tar.bz2 shiftos_thereturn-31cc9148dd23737df16d8456a42d003cd31dd488.zip | |
holy ashit
Diffstat (limited to 'ShiftOS_TheReturn/ServerManager.cs')
| -rw-r--r-- | ShiftOS_TheReturn/ServerManager.cs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index 0bdfcd9..825064b 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -35,6 +35,7 @@ using ShiftOS; using static ShiftOS.Engine.SaveSystem; using Newtonsoft.Json; using System.Net.Sockets; +using System.Diagnostics; namespace ShiftOS.Engine { @@ -54,6 +55,12 @@ namespace ShiftOS.Engine private static NetObjectClient client { get; set; } private static bool UserDisconnect = false; + public static long DigitalSocietyPing + { + get; + private set; + } + public static void Disconnect() { UserDisconnect = true; @@ -139,6 +146,11 @@ namespace ShiftOS.Engine }; client.OnReceived += (o, a) => { + if (PingTimer.IsRunning) + { + DigitalSocietyPing = PingTimer.ElapsedMilliseconds; + PingTimer.Reset(); + } var msg = a.Data.Object as ServerMessage; if (msg.Name == "Welcome") { @@ -207,6 +219,8 @@ namespace ShiftOS.Engine } } + private static Stopwatch PingTimer = new Stopwatch(); + public static void SendMessage(string name, string contents) { var sMsg = new ServerMessage @@ -215,7 +229,7 @@ namespace ShiftOS.Engine Contents = contents, GUID = thisGuid.ToString(), }; - + PingTimer.Start(); client.Send(new NetObject("msg", sMsg)); } |
