Browse code

core: renamed recent params wait_child1_* to wait_worker1_*

- consistent with the event route name

Daniel-Constantin Mierla authored on 16/03/2021 08:33:04
Showing 5 changed files
... ...
@@ -467,9 +467,9 @@ VERBOSE_STARTUP		"verbose_startup"
467 467
 
468 468
 SERVER_ID     "server_id"
469 469
 ROUTE_LOCKS_SIZE     "route_locks_size"
470
-WAIT_CHILD1_MODE     "wait_child1_mode"
471
-WAIT_CHILD1_TIME     "wait_child1_time"
472
-WAIT_CHILD1_USLEEP   "wait_child1_usleep"
470
+WAIT_WORKER1_MODE     "wait_worker1_mode"
471
+WAIT_WORKER1_TIME     "wait_worker1_time"
472
+WAIT_WORKER1_USLEEP   "wait_worker1_usleep"
473 473
 
474 474
 KEMI     "kemi"
475 475
 ONSEND_ROUTE_CALLBACK	"onsend_route_callback"
... ...
@@ -992,9 +992,9 @@ IMPORTFILE      "import_file"
992 992
 <INITIAL>{VERBOSE_STARTUP}		{	count(); yylval.strval=yytext;
993 993
 									return VERBOSE_STARTUP; }
994 994
 <INITIAL>{ROUTE_LOCKS_SIZE}  { count(); yylval.strval=yytext; return ROUTE_LOCKS_SIZE; }
995
-<INITIAL>{WAIT_CHILD1_MODE}  { count(); yylval.strval=yytext; return WAIT_CHILD1_MODE; }
996
-<INITIAL>{WAIT_CHILD1_TIME}  { count(); yylval.strval=yytext; return WAIT_CHILD1_TIME; }
997
-<INITIAL>{WAIT_CHILD1_USLEEP}  { count(); yylval.strval=yytext; return WAIT_CHILD1_USLEEP; }
995
+<INITIAL>{WAIT_WORKER1_MODE}  { count(); yylval.strval=yytext; return WAIT_WORKER1_MODE; }
996
+<INITIAL>{WAIT_WORKER1_TIME}  { count(); yylval.strval=yytext; return WAIT_WORKER1_TIME; }
997
+<INITIAL>{WAIT_WORKER1_USLEEP}  { count(); yylval.strval=yytext; return WAIT_WORKER1_USLEEP; }
998 998
 <INITIAL>{SERVER_ID}  { count(); yylval.strval=yytext; return SERVER_ID;}
999 999
 <INITIAL>{KEMI}  { count(); yylval.strval=yytext; return KEMI;}
1000 1000
 <INITIAL>{REPLY_ROUTE_CALLBACK}  { count(); yylval.strval=yytext; return REPLY_ROUTE_CALLBACK;}
... ...
@@ -498,9 +498,9 @@ extern char *default_routename;
498 498
 %token VERSION_TABLE_CFG
499 499
 %token VERBOSE_STARTUP
500 500
 %token ROUTE_LOCKS_SIZE
501
-%token WAIT_CHILD1_MODE
502
-%token WAIT_CHILD1_TIME
503
-%token WAIT_CHILD1_USLEEP
501
+%token WAIT_WORKER1_MODE
502
+%token WAIT_WORKER1_TIME
503
+%token WAIT_WORKER1_USLEEP
504 504
 %token CFG_DESCRIPTION
505 505
 %token SERVER_ID
506 506
 %token KEMI
... ...
@@ -1705,10 +1705,12 @@ assign_stm:
1705 1705
 	| VERBOSE_STARTUP EQUAL error { yyerror("boolean value expected"); }
1706 1706
 	| ROUTE_LOCKS_SIZE EQUAL NUMBER { ksr_route_locks_size=$3; }
1707 1707
 	| ROUTE_LOCKS_SIZE EQUAL error { yyerror("number expected"); }
1708
-	| WAIT_CHILD1_MODE EQUAL NUMBER { ksr_wait_child1_mode=$3; }
1709
-	| WAIT_CHILD1_MODE EQUAL error { yyerror("number expected"); }
1710
-	| WAIT_CHILD1_TIME EQUAL NUMBER { ksr_wait_child1_time=$3; }
1711
-	| WAIT_CHILD1_TIME EQUAL error { yyerror("number expected"); }
1708
+	| WAIT_WORKER1_MODE EQUAL NUMBER { ksr_wait_worker1_mode=$3; }
1709
+	| WAIT_WORKER1_MODE EQUAL error { yyerror("number expected"); }
1710
+	| WAIT_WORKER1_TIME EQUAL NUMBER { ksr_wait_worker1_time=$3; }
1711
+	| WAIT_WORKER1_TIME EQUAL error { yyerror("number expected"); }
1712
+	| WAIT_WORKER1_USLEEP EQUAL NUMBER { ksr_wait_worker1_usleep=$3; }
1713
+	| WAIT_WORKER1_USLEEP EQUAL error { yyerror("number expected"); }
1712 1714
     | SERVER_ID EQUAL NUMBER { server_id=$3; }
1713 1715
 	| SERVER_ID EQUAL error  { yyerror("number expected"); }
1714 1716
 	| KEMI DOT ONSEND_ROUTE_CALLBACK EQUAL STRING {
... ...
@@ -218,10 +218,10 @@ extern str _ksr_xavp_via_fields;
218 218
 extern int ksr_sip_parser_mode;
219 219
 extern int ksr_cfg_print_mode;
220 220
 
221
-extern int ksr_wait_child1_mode;
222
-extern int ksr_wait_child1_time;
223
-extern int ksr_wait_child1_usleep;
224
-extern int *ksr_wait_child1_done;
221
+extern int ksr_wait_worker1_mode;
222
+extern int ksr_wait_worker1_time;
223
+extern int ksr_wait_worker1_usleep;
224
+extern int *ksr_wait_worker1_done;
225 225
 
226 226
 extern char *_sr_uri_host_extra_chars;
227 227
 extern unsigned char *_ksr_hname_extra_chars;
... ...
@@ -5108,17 +5108,19 @@ int tcp_init_children(int *woneinit)
5108 5108
 			goto error;
5109 5109
 		}else if (pid>0){
5110 5110
 			/* parent - main process */
5111
-			if(*woneinit==0 && ksr_wait_child1_mode!=0) {
5111
+			if(*woneinit==0 && ksr_wait_worker1_mode!=0) {
5112 5112
 				int wcount=0;
5113
-				while(*ksr_wait_child1_done==0) {
5114
-					sleep_us(ksr_wait_child1_usleep);
5113
+				while(*ksr_wait_worker1_done==0) {
5114
+					sleep_us(ksr_wait_worker1_usleep);
5115 5115
 					wcount++;
5116
-					if(ksr_wait_child1_time<=wcount*ksr_wait_child1_usleep) {
5116
+					if(ksr_wait_worker1_time<=wcount*ksr_wait_worker1_usleep) {
5117 5117
 						LM_ERR("waiting for child one too long - wait time: %d\n",
5118
-								ksr_wait_child1_time);
5118
+								ksr_wait_worker1_time);
5119 5119
 						goto error;
5120 5120
 					}
5121 5121
 				}
5122
+				LM_DBG("child one initialized after %d wait steps\n",
5123
+							wcount);
5122 5124
 			}
5123 5125
 			*woneinit = 1;
5124 5126
 		}else{
... ...
@@ -5129,8 +5131,9 @@ int tcp_init_children(int *woneinit)
5129 5131
 				if(run_child_one_init_route()<0)
5130 5132
 					goto error;
5131 5133
 			}
5132
-			if(ksr_wait_child1_mode!=0) {
5133
-				*ksr_wait_child1_done = 1;
5134
+			if(ksr_wait_worker1_mode!=0) {
5135
+				*ksr_wait_worker1_done = 1;
5136
+				LM_DBG("child one finished initialization\n");
5134 5137
 			}
5135 5138
 
5136 5139
 			tcp_receive_loop(reader_fd_1);
... ...
@@ -540,10 +540,10 @@ static int *_sr_instance_started = NULL;
540 540
 int ksr_cfg_print_mode = 0;
541 541
 int ksr_atexit_mode = 1;
542 542
 
543
-int ksr_wait_child1_mode = 0;
544
-int ksr_wait_child1_time = 4000000;
545
-int ksr_wait_child1_usleep = 100000;
546
-int *ksr_wait_child1_done = NULL;
543
+int ksr_wait_worker1_mode = 0;
544
+int ksr_wait_worker1_time = 4000000;
545
+int ksr_wait_worker1_usleep = 100000;
546
+int *ksr_wait_worker1_done = NULL;
547 547
 
548 548
 /**
549 549
  * return 1 if all child processes were forked
... ...
@@ -1655,13 +1655,13 @@ int main_loop(void)
1655 1655
 
1656 1656
 
1657 1657
 		woneinit = 0;
1658
-		if(ksr_wait_child1_mode!=0) {
1659
-			ksr_wait_child1_done=(int*)shm_malloc(sizeof(int));
1660
-			if(ksr_wait_child1_done==0) {
1658
+		if(ksr_wait_worker1_mode!=0) {
1659
+			ksr_wait_worker1_done=(int*)shm_malloc(sizeof(int));
1660
+			if(ksr_wait_worker1_done==0) {
1661 1661
 				SHM_MEM_ERROR;
1662 1662
 				goto error;
1663 1663
 			}
1664
-			*ksr_wait_child1_done = 0;
1664
+			*ksr_wait_worker1_done = 0;
1665 1665
 		}
1666 1666
 		/* udp processes */
1667 1667
 		for(si=udp_listen; si; si=si->next){
... ...
@@ -1701,23 +1701,26 @@ int main_loop(void)
1701 1701
 						if(run_child_one_init_route()<0)
1702 1702
 							goto error;
1703 1703
 					}
1704
-					if(ksr_wait_child1_mode!=0) {
1705
-						*ksr_wait_child1_done = 1;
1704
+					if(ksr_wait_worker1_mode!=0) {
1705
+						*ksr_wait_worker1_done = 1;
1706
+						LM_DBG("child one finished initialization\n");
1706 1707
 					}
1707 1708
 					return udp_rcv_loop();
1708 1709
 				}
1709 1710
 				/* main process */
1710
-				if(woneinit==0 && ksr_wait_child1_mode!=0) {
1711
+				if(woneinit==0 && ksr_wait_worker1_mode!=0) {
1711 1712
 					int wcount=0;
1712
-					while(*ksr_wait_child1_done==0) {
1713
-						sleep_us(ksr_wait_child1_usleep);
1713
+					while(*ksr_wait_worker1_done==0) {
1714
+						sleep_us(ksr_wait_worker1_usleep);
1714 1715
 						wcount++;
1715
-						if(ksr_wait_child1_time<=wcount*ksr_wait_child1_usleep) {
1716
+						if(ksr_wait_worker1_time<=wcount*ksr_wait_worker1_usleep) {
1716 1717
 							LM_ERR("waiting for child one too long - wait time: %d\n",
1717
-									ksr_wait_child1_time);
1718
+									ksr_wait_worker1_time);
1718 1719
 							goto error;
1719 1720
 						}
1720 1721
 					}
1722
+					LM_DBG("child one initialized after %d wait steps\n",
1723
+							wcount);
1721 1724
 				}
1722 1725
 				woneinit = 1;
1723 1726
 			}
... ...
@@ -1752,23 +1755,26 @@ int main_loop(void)
1752 1755
 							if(run_child_one_init_route()<0)
1753 1756
 								goto error;
1754 1757
 						}
1755
-						if(ksr_wait_child1_mode!=0) {
1756
-							*ksr_wait_child1_done = 1;
1758
+						if(ksr_wait_worker1_mode!=0) {
1759
+							*ksr_wait_worker1_done = 1;
1760
+							LM_DBG("child one finished initialization\n");
1757 1761
 						}
1758 1762
 						return sctp_core_rcv_loop();
1759 1763
 					}
1760 1764
 					/* main process */
1761
-					if(woneinit==0 && ksr_wait_child1_mode!=0) {
1765
+					if(woneinit==0 && ksr_wait_worker1_mode!=0) {
1762 1766
 						int wcount=0;
1763
-						while(*ksr_wait_child1_done==0) {
1764
-							sleep_us(ksr_wait_child1_usleep);
1767
+						while(*ksr_wait_worker1_done==0) {
1768
+							sleep_us(ksr_wait_worker1_usleep);
1765 1769
 							wcount++;
1766
-							if(ksr_wait_child1_time<=wcount*ksr_wait_child1_usleep) {
1770
+							if(ksr_wait_worker1_time<=wcount*ksr_wait_worker1_usleep) {
1767 1771
 								LM_ERR("waiting for child one too long - wait time: %d\n",
1768
-										ksr_wait_child1_time);
1772
+										ksr_wait_worker1_time);
1769 1773
 								goto error;
1770 1774
 							}
1771 1775
 						}
1776
+						LM_DBG("child one initialized after %d wait steps\n",
1777
+								wcount);
1772 1778
 					}
1773 1779
 					woneinit = 1;
1774 1780
 				}