summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Matveev <stargrave@stargrave.org>2015-11-04 17:53:20 +0300
committerSergey Matveev <stargrave@stargrave.org>2015-11-04 17:53:20 +0300
commita06713ebfdbd58c7ffbbcdfa95e9761e0861590b (patch)
treed60495ed99426e6b50554ceac8790ac8bb414994
parent1c14ece74f6763d5794d1c89cbd18b05bc23bdcc (diff)
downloadgoircd-a06713ebfdbd58c7ffbbcdfa95e9761e0861590b.tar.xz
If no states are kept, then clear an empty rooms
-rw-r--r--daemon.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/daemon.go b/daemon.go
index 3afda4f..0896add 100644
--- a/daemon.go
+++ b/daemon.go
@@ -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:
for _, sink := range roomSinks {
sink <- ClientEvent{eventType: EventTerm}