mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-13 15:34:38 +01:00
fix issue where broadcasts can go to unmapped sessions
This commit is contained in:
@@ -135,7 +135,6 @@ func destructEmptyStages(s *Session) {
|
||||
|
||||
func removeSessionFromStage(s *Session) {
|
||||
// Remove client from old stage.
|
||||
s.stage.Lock()
|
||||
delete(s.stage.clients, s)
|
||||
|
||||
// Delete old stage objects owned by the client.
|
||||
@@ -146,7 +145,6 @@ func removeSessionFromStage(s *Session) {
|
||||
delete(s.stage.objects, object.ownerCharID)
|
||||
}
|
||||
}
|
||||
s.stage.Unlock()
|
||||
destructEmptyStages(s)
|
||||
destructEmptySemaphores(s)
|
||||
}
|
||||
|
||||
@@ -69,6 +69,8 @@ func NewStage(ID string) *Stage {
|
||||
|
||||
// BroadcastMHF queues a MHFPacket to be sent to all sessions in the stage.
|
||||
func (s *Stage) BroadcastMHF(pkt mhfpacket.MHFPacket, ignoredSession *Session) {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
// Broadcast the data.
|
||||
for session := range s.clients {
|
||||
if session == ignoredSession {
|
||||
|
||||
Reference in New Issue
Block a user