tsaikd / gogstash

Logstash like, written in golang
MIT License
644 stars 106 forks source link

inputsocket: Idle TCP sessions #158

Closed helgeolav closed 3 years ago

helgeolav commented 3 years ago

InputConfig.parse calls bufio.Reader.ReadBytes() that blocks for a predetermined time if there is no new data on a socket. When you hit ctrl+c to stop gogstash the listener is closed, but not active TCP connections. When ReadBytes times out (or receives new data) it will check ctx.Done() and then exit. But that can take some time.

This change closes all active TCP sessions so each parse() loop can exit and then close the program.