mirror of
https://github.com/yudai/gotty.git
synced 2026-02-16 05:08:06 +01:00
Ensure only one client can connect when --once is given
Using a mutex
This commit is contained in:
parent
e1de07bce2
commit
46e33887c4
2 changed files with 19 additions and 7 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue