From 7ba1348b1a9cbfc53f902ea43282d6207fc40313 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 21 Dec 2015 08:45:13 +0100 Subject: minor cleanup for session testing diff --git a/session.go b/session.go index ce84053..8f20958 100644 --- a/session.go +++ b/session.go @@ -149,7 +149,9 @@ func (self *Session) dispatchRequests() { for { select { case <-self.runChan: - self.run() + if !self.running { + self.run() + } case <-self.cancelChan: if self.running { rhdl.Println("Session: canceling running imports is not yet implemented") @@ -168,8 +170,6 @@ func (self *Session) dispatchRequests() { self.running = false rhdl.Printf("Session: import is done: %+v", result) // TODO: call all subscribed done handler - // TODO: send remove request to session store? - return } } } @@ -185,6 +185,7 @@ func (self *Session) getInterface() *SessionChan { func (self *Session) Cleanup() { // TODO: this blocks if dispatchRequests has ended already... + // or if cancel doesn't work... self.cancelChan <- true <-self.done close(self.done) -- cgit v0.10.2