src/server/daemon/srvctrl.c

changeset 619
4e2bac64c950
parent 584
f3ddd6dc8e7b
equal deleted inserted replaced
618:e42a8de6d66f 619:4e2bac64c950
103 103
104 for(;;) { 104 for(;;) {
105 int fd = accept(srvctrl, NULL, 0); 105 int fd = accept(srvctrl, NULL, 0);
106 if(fd < 0) { 106 if(fd < 0) {
107 if(srv_shutdown) break; 107 if(srv_shutdown) break;
108
108 log_ereport( 109 log_ereport(
109 LOG_FAILURE, 110 LOG_FAILURE,
110 "srvctrl: accept failed: %s", 111 "srvctrl: accept failed: %s",
111 strerror(errno)); 112 strerror(errno));
113
114 int err = errno;
115 if(err == EMFILE || err == ENFILE) {
116 sleep(5);
117 continue;
118 }
119
112 break; 120 break;
113 } 121 }
114 122
115 SrvCtrlClient *client = srvctrl_create_client(fd); 123 SrvCtrlClient *client = srvctrl_create_client(fd);
116 SYS_THREAD t = systhread_start( 124 SYS_THREAD t = systhread_start(
184 if(!webserver_reconfig()) { 192 if(!webserver_reconfig()) {
185 log_ereport(LOG_INFORM, "reconfig: success"); 193 log_ereport(LOG_INFORM, "reconfig: success");
186 } 194 }
187 } else if(!cx_strcmp(cx_strcast(cmd), cx_str("shutdown"))) { 195 } else if(!cx_strcmp(cx_strcast(cmd), cx_str("shutdown"))) {
188 webserver_shutdown(); 196 webserver_shutdown();
197 } else if(!cx_strcmp(cx_strcast(cmd), cx_str("stop"))) {
198 webserver_stop();
189 } else if(!cx_strcmp(cx_strcast(cmd), cx_str("stat"))) { 199 } else if(!cx_strcmp(cx_strcast(cmd), cx_str("stat"))) {
190 // TODO: implement 200 // TODO: implement
191 } else if(!cx_strcmp(cx_strcast(cmd), cx_str("log"))) { 201 } else if(!cx_strcmp(cx_strcast(cmd), cx_str("log"))) {
192 return 0; 202 return 0;
193 } else { 203 } else {

mercurial