mirror of
https://github.com/coredns/coredns.git
synced 2026-07-13 11:10:10 -04:00
plugin/dnstap: close the previous connection before reconnecting (#8224)
This commit is contained in:
committed by
GitHub
parent
b1a0d2f287
commit
19ce0e173a
@@ -64,7 +64,17 @@ func newIO(proto, endpoint string, multipleQueue int, multipleTcpWriteBuf int) *
|
||||
}
|
||||
}
|
||||
|
||||
// dial opens a new connection to the dnstap endpoint and installs the new
|
||||
// encoder on d.enc. Any previous encoder (and the socket beneath it) is
|
||||
// flushed and closed first so a reconnect after a write error does not leak
|
||||
// the old connection.
|
||||
func (d *dio) dial() error {
|
||||
if d.enc != nil {
|
||||
d.enc.flush()
|
||||
d.enc.close()
|
||||
d.enc = nil
|
||||
}
|
||||
|
||||
var conn net.Conn
|
||||
var err error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user