Skip to content

Commit

Permalink
Merge pull request #24 from systemli/Disable-TCP-Keep-Alive
Browse files Browse the repository at this point in the history
Disable TCP Keep Alive
  • Loading branch information
0x46616c6b authored Dec 2, 2024
2 parents 79c6e63 + b725ac0 commit 835640b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import (
func StartTCPServer(ctx context.Context, wg *sync.WaitGroup, addr string, handler func(net.Conn)) {
defer wg.Done()

listener, err := net.Listen("tcp", addr)
lc := net.ListenConfig{
KeepAlive: -1,
}

listener, err := lc.Listen(ctx, "tcp", addr)
if err != nil {
log.WithError(err).Error("Error creating listener")
return
Expand Down

0 comments on commit 835640b

Please sign in to comment.