From d5f10048e1ad15a8b3d3526dace3c05ef71d0d3f Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Wed, 4 Nov 2015 17:53:20 +0300 Subject: [PATCH] If no states are kept, then clear an empty rooms --- daemon.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/daemon.go b/daemon.go index e56b7b5..238b7c8 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}