ctrl-c to close on clients
This commit is contained in:
@@ -50,5 +50,12 @@ func handle(ctx context.Context, config Config, conn net.Conn) {
|
||||
func _handle(ctx context.Context, config Config, conn net.Conn) error {
|
||||
defer conn.Close()
|
||||
|
||||
ctx, can := context.WithCancel(ctx)
|
||||
defer can()
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
conn.Close()
|
||||
}()
|
||||
|
||||
return adapt(ctx, config, conn)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user