release gorutines

This commit is contained in:
Liang Ding 2015-03-19 11:42:52 +08:00
parent 73cfcdce55
commit 4b9c72f440
2 changed files with 9 additions and 3 deletions

View File

@ -131,6 +131,8 @@ func (ueqs queues) Close(sid string) {
return
}
close(q.Queue)
delete(ueqs, sid)
}

View File

@ -365,15 +365,19 @@ func (sessions *wSessions) New(httpSession *sessions.Session, sid string) *WideS
defer util.Recover()
for {
ch := SessionWS[sid]
if nil == ch {
return // release this gorutine
}
select {
case event := <-watcher.Events:
path := event.Name
dir := filepath.Dir(path)
ch := SessionWS[sid]
ch = SessionWS[sid]
if nil == ch {
break
return // release this gorutine
}
if event.Op&fsnotify.Create == fsnotify.Create {