summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-21 07:45:13 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-21 07:45:13 (GMT)
commit7ba1348b1a9cbfc53f902ea43282d6207fc40313 (patch)
tree2246323d0788c896f1b4f1fe6e16f5fc4d7607a4
parent795d37b3aa2ee04f9a56a9a75284b0a4ac8a4b0f (diff)
minor cleanup for session testing
-rw-r--r--session.go7
1 files changed, 4 insertions, 3 deletions
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)