File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -296,7 +296,7 @@ func (f *Fluent) Close() (err error) {
296296 close (f .pending )
297297 f .wg .Wait ()
298298 }
299- f .close ()
299+ f .close (f . conn )
300300 return
301301}
302302
@@ -311,9 +311,9 @@ func (f *Fluent) appendBuffer(msg *msgToSend) error {
311311}
312312
313313// close closes the connection.
314- func (f * Fluent ) close () {
314+ func (f * Fluent ) close (c net. Conn ) {
315315 f .muconn .Lock ()
316- if f .conn != nil {
316+ if f .conn != nil && f . conn == c {
317317 f .conn .Close ()
318318 f .conn = nil
319319 }
@@ -386,7 +386,7 @@ func (f *Fluent) write(msg *msgToSend) error {
386386 }
387387 _ , err := c .Write (msg .data )
388388 if err != nil {
389- f .close ()
389+ f .close (c )
390390 } else {
391391 // Acknowledgment check
392392 if msg .ack != "" {
@@ -399,7 +399,7 @@ func (f *Fluent) write(msg *msgToSend) error {
399399 err = resp .DecodeMsg (r )
400400 }
401401 if err != nil || resp .Ack != msg .ack {
402- f .close ()
402+ f .close (c )
403403 continue
404404 }
405405 }
You can’t perform that action at this time.
0 commit comments