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.
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.