mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 07:55:33 +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) {
|
func removeSessionFromStage(s *Session) {
|
||||||
// Remove client from old stage.
|
// Remove client from old stage.
|
||||||
s.stage.Lock()
|
|
||||||
delete(s.stage.clients, s)
|
delete(s.stage.clients, s)
|
||||||
|
|
||||||
// Delete old stage objects owned by the client.
|
// Delete old stage objects owned by the client.
|
||||||
@@ -146,7 +145,6 @@ func removeSessionFromStage(s *Session) {
|
|||||||
delete(s.stage.objects, object.ownerCharID)
|
delete(s.stage.objects, object.ownerCharID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.stage.Unlock()
|
|
||||||
destructEmptyStages(s)
|
destructEmptyStages(s)
|
||||||
destructEmptySemaphores(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.
|
// BroadcastMHF queues a MHFPacket to be sent to all sessions in the stage.
|
||||||
func (s *Stage) BroadcastMHF(pkt mhfpacket.MHFPacket, ignoredSession *Session) {
|
func (s *Stage) BroadcastMHF(pkt mhfpacket.MHFPacket, ignoredSession *Session) {
|
||||||
|
s.Lock()
|
||||||
|
defer s.Unlock()
|
||||||
// Broadcast the data.
|
// Broadcast the data.
|
||||||
for session := range s.clients {
|
for session := range s.clients {
|
||||||
if session == ignoredSession {
|
if session == ignoredSession {
|
||||||
|
|||||||
Reference in New Issue
Block a user