This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
servers clean up disconnects properly (#5086)
Co-authored-by: Gheric Speiginer <gheric.speiginer@gmail.com>
- Loading branch information
Showing
6 changed files
with
65 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Network } from '../../networking/classes/Network' | ||
import { NetworkTransport } from '../../networking/interfaces/NetworkTransport' | ||
import { World } from '../classes/World' | ||
|
||
const sendActionsOnTransport = (transport: NetworkTransport) => (world: World) => { | ||
const { outgoingActions } = world | ||
|
||
for (const o of outgoingActions) console.log('OUTGOING', o) | ||
|
||
try { | ||
transport.sendActions(outgoingActions) | ||
} catch (e) { | ||
console.error(e) | ||
} | ||
|
||
outgoingActions.clear() | ||
|
||
return world | ||
} | ||
|
||
export default async function ActionDispatchSystem(world: World) { | ||
const worldTransport = Network.instance.transportHandler.getWorldTransport() | ||
const sendActions = sendActionsOnTransport(worldTransport) | ||
|
||
return () => { | ||
sendActions(world) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters