If no states are kept, then clear an empty rooms

This commit is contained in:
Sergey Matveev 2015-11-04 17:53:20 +03:00 committed by User Mue
parent 493dc78a24
commit d5f10048e1

View File

@ -308,6 +308,14 @@ func Processor(events chan ClientEvent, finished chan struct{}) {
} }
} }
} }
for rn, r := range rooms {
if *statedir == "" && len(r.members) == 0 {
log.Println(rn, "emptied room")
delete(rooms, rn)
close(roomSinks[r])
delete(roomSinks, r)
}
}
case EventTerm: case EventTerm:
for _, sink := range roomSinks { for _, sink := range roomSinks {
sink <- ClientEvent{eventType: EventTerm} sink <- ClientEvent{eventType: EventTerm}