ctrl-c to close on clients

This commit is contained in:
Bel LaPointe
2026-02-04 08:38:09 -07:00
parent 03b2d35cd3
commit 8b8fafca21

View File

@@ -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)
}