Ensure only one client can connect when --once is given

Using a mutex
This commit is contained in:
Iwasaki Yudai 2015-10-08 14:32:49 +09:00
parent e1de07bce2
commit 46e33887c4
2 changed files with 19 additions and 7 deletions

View file

@ -65,13 +65,6 @@ func (context *clientContext) goHandleClient() {
context.processReceive()
}()
context.app.server.StartRoutine()
if context.app.options.Once {
log.Printf("Last client accepted, closing the listener.")
context.app.server.Close()
}
go func() {
defer context.app.server.FinishRoutine()