Changeset 500 for TFP-WebServer/WebServer/src
- Timestamp:
- Jul 29, 2024, 4:48:56 PM (5 months ago)
- Location:
- TFP-WebServer/WebServer/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TFP-WebServer/WebServer/src/ModApi.cs
r404 r500 12 12 public void InitMod (Mod _modInstance) { 13 13 ModEvents.GameStartDone.RegisterHandler (GameStartDone); 14 ModEvents. GameShutdown.RegisterHandler (GameShutdown);14 ModEvents.WorldShuttingDown.RegisterHandler (WorldShuttingDown); 15 15 modInstance = _modInstance; 16 16 … … 31 31 } 32 32 33 private void GameShutdown () {34 webInstance?. Shutdown();33 private void WorldShuttingDown () { 34 webInstance?.Disconnect (); 35 35 } 36 36 } -
TFP-WebServer/WebServer/src/Web.cs
r487 r500 30 30 private readonly AsyncCallback handleRequestDelegate; 31 31 32 private bool shutdown; 33 32 34 public Web (string _modInstancePath) { 33 35 try { … … 150 152 151 153 public void Disconnect () { 154 if (shutdown) { 155 return; 156 } 157 158 shutdown = true; 159 152 160 try { 161 foreach (AbsHandler handler in handlers) { 162 handler.Shutdown (); 163 } 164 153 165 listener.Stop (); 154 166 listener.Close (); 155 167 } catch (Exception e) { 156 168 Log.Out ($"[Web] Error in Web.Disconnect: {e}"); 157 }158 }159 160 public void Shutdown () {161 foreach (AbsHandler handler in handlers) {162 handler.Shutdown ();163 169 } 164 170 }
Note:
See TracChangeset
for help on using the changeset viewer.