File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,9 @@ struct flb_downstream {
4545
4646 /* this is a config map reference coming from the plugin net_setup field */
4747 struct flb_net_setup * net_setup ;
48+
49+ /* pause state */
50+ int paused ;
4851};
4952
5053static inline int flb_downstream_is_shutting_down (struct flb_downstream * downstream )
@@ -76,6 +79,9 @@ int flb_downstream_set_property(struct flb_config *config,
7679
7780struct flb_connection * flb_downstream_conn_get (struct flb_downstream * stream );
7881
82+ void flb_downstream_pause (struct flb_downstream * stream );
83+ void flb_downstream_resume (struct flb_downstream * stream );
84+
7985int flb_downstream_conn_release (struct flb_connection * connection );
8086
8187int flb_downstream_conn_pending_destroy_list (struct mk_list * list );
Original file line number Diff line number Diff line change @@ -283,6 +283,18 @@ struct flb_connection *flb_downstream_conn_get(struct flb_downstream *stream)
283283
284284 transport = stream -> base .transport ;
285285
286+ if (stream -> paused ) {
287+ if (transport != FLB_TRANSPORT_UDP &&
288+ transport != FLB_TRANSPORT_UNIX_DGRAM ) {
289+ connection_fd = flb_net_accept (stream -> server_fd );
290+ if (connection_fd >= 0 ) {
291+ flb_socket_close (connection_fd );
292+ }
293+ }
294+
295+ return NULL ;
296+ }
297+
286298 if (transport == FLB_TRANSPORT_UDP ||
287299 transport == FLB_TRANSPORT_UNIX_DGRAM ) {
288300 if (stream -> dgram_connection != NULL ) {
@@ -357,6 +369,20 @@ struct flb_connection *flb_downstream_conn_get(struct flb_downstream *stream)
357369 return connection ;
358370}
359371
372+ void flb_downstream_pause (struct flb_downstream * stream )
373+ {
374+ if (stream ) {
375+ stream -> paused = FLB_TRUE ;
376+ }
377+ }
378+
379+ void flb_downstream_resume (struct flb_downstream * stream )
380+ {
381+ if (stream ) {
382+ stream -> paused = FLB_FALSE ;
383+ }
384+ }
385+
360386void flb_downstream_destroy (struct flb_downstream * stream )
361387{
362388 struct flb_connection * connection ;
You can’t perform that action at this time.
0 commit comments