File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,9 @@ struct flb_upstream_conn {
46
46
/* Keepalive */
47
47
int ka_count ; /* how many times this connection has been used */
48
48
49
+ /* do we need to mk_event_del the keepalive event on clean up*/
50
+ int ka_dropped_event_added ;
51
+
49
52
/*
50
53
* Custom 'error' for the connection file descriptor. Commonly used to
51
54
* specify a reason for an exception that was generated locally: consider
Original file line number Diff line number Diff line change @@ -429,7 +429,7 @@ static int prepare_destroy_conn(struct flb_upstream_conn *u_conn)
429
429
flb_trace ("[upstream] destroy connection #%i to %s:%i" ,
430
430
u_conn -> fd , u -> tcp_host , u -> tcp_port );
431
431
432
- if (u -> flags & FLB_IO_ASYNC ) {
432
+ if (u -> flags & FLB_IO_ASYNC || u_conn -> ka_dropped_event_added == FLB_TRUE ) {
433
433
mk_event_del (u_conn -> evl , & u_conn -> event );
434
434
}
435
435
@@ -514,6 +514,8 @@ static struct flb_upstream_conn *create_conn(struct flb_upstream *u)
514
514
conn -> net_error = -1 ;
515
515
conn -> busy_flag = FLB_TRUE ;
516
516
517
+ conn -> ka_dropped_event_added = FLB_FALSE ;
518
+
517
519
/* retrieve the event loop */
518
520
evl = flb_engine_evl_get ();
519
521
conn -> evl = evl ;
@@ -769,6 +771,7 @@ int flb_upstream_conn_release(struct flb_upstream_conn *conn)
769
771
conn -> fd , conn -> u -> tcp_host , conn -> u -> tcp_port );
770
772
return prepare_destroy_conn_safe (conn );
771
773
}
774
+ conn -> ka_dropped_event_added = FLB_TRUE ;
772
775
773
776
flb_debug ("[upstream] KA connection #%i to %s:%i is now available" ,
774
777
conn -> fd , conn -> u -> tcp_host , conn -> u -> tcp_port );
You can’t perform that action at this time.
0 commit comments