@@ -358,7 +358,9 @@ static int in_fw_init(struct flb_input_instance *ins,
358
358
359
359
static void in_fw_pause (void * data , struct flb_config * config )
360
360
{
361
+ int ret ;
361
362
struct flb_in_fw_config * ctx = data ;
363
+
362
364
if (config -> is_running == FLB_TRUE ) {
363
365
/*
364
366
* This is the case when we are not in a shutdown phase, but
@@ -367,11 +369,20 @@ static void in_fw_pause(void *data, struct flb_config *config)
367
369
* and wait for the ingestion to resume.
368
370
*/
369
371
flb_input_collector_pause (ctx -> coll_fd , ctx -> ins );
370
- if (pthread_mutex_lock (& ctx -> conn_mutex )) {
371
- fw_conn_del_all (ctx );
372
- ctx -> is_paused = FLB_TRUE ;
372
+
373
+ ret = pthread_mutex_lock (& ctx -> conn_mutex );
374
+ if (ret != 0 ) {
375
+ flb_plg_error (ctx -> ins , "cannot lock collector mutex" );
376
+ return ;
377
+ }
378
+
379
+ fw_conn_del_all (ctx );
380
+ ctx -> is_paused = FLB_TRUE ;
381
+ ret = pthread_mutex_unlock (& ctx -> conn_mutex );
382
+ if (ret != 0 ) {
383
+ flb_plg_error (ctx -> ins , "cannot unlock collector mutex" );
384
+ return ;
373
385
}
374
- pthread_mutex_unlock (& ctx -> conn_mutex );
375
386
}
376
387
377
388
/*
@@ -388,13 +399,24 @@ static void in_fw_pause(void *data, struct flb_config *config)
388
399
}
389
400
390
401
static void in_fw_resume (void * data , struct flb_config * config ) {
402
+ int ret ;
391
403
struct flb_in_fw_config * ctx = data ;
404
+
392
405
if (config -> is_running == FLB_TRUE ) {
393
406
flb_input_collector_resume (ctx -> coll_fd , ctx -> ins );
394
- if (pthread_mutex_lock (& ctx -> conn_mutex )) {
395
- ctx -> is_paused = FLB_FALSE ;
407
+
408
+ ret = pthread_mutex_lock (& ctx -> conn_mutex );
409
+ if (ret != 0 ) {
410
+ flb_plg_error (ctx -> ins , "cannot lock collector mutex" );
411
+ return ;
412
+ }
413
+
414
+ ctx -> is_paused = FLB_FALSE ;
415
+ ret = pthread_mutex_unlock (& ctx -> conn_mutex );
416
+ if (ret != 0 ) {
417
+ flb_plg_error (ctx -> ins , "cannot unlock collector mutex" );
418
+ return ;
396
419
}
397
- pthread_mutex_unlock (& ctx -> conn_mutex );
398
420
}
399
421
}
400
422
0 commit comments