43 |
43 |
44 #include "webserver.h" |
44 #include "webserver.h" |
45 #include "log.h" |
45 #include "log.h" |
46 #include "httprequest.h" |
46 #include "httprequest.h" |
47 #include "httplistener.h" |
47 #include "httplistener.h" |
|
48 #include "srvctrl.h" |
48 |
49 |
49 #include "configmanager.h" |
50 #include "configmanager.h" |
50 |
51 |
51 static int std_pipe_fds[2]; |
52 static int std_pipe_fds[2]; |
52 static WSBool is_daemon; |
53 static WSBool is_daemon; |
97 } |
98 } |
98 |
99 |
99 //fclose(log_out); |
100 //fclose(log_out); |
100 |
101 |
101 return NULL; |
102 return NULL; |
102 } |
|
103 |
|
104 void handle_srvctrl() { |
|
105 int srvctrl = webserver_srvctrl_fd(); |
|
106 listen(srvctrl, 8); |
|
107 |
|
108 for(;;) { |
|
109 int admin_client = accept(srvctrl, NULL, 0); |
|
110 if(admin_client < 0) { |
|
111 log_ereport( |
|
112 LOG_FAILURE, |
|
113 "srvctrl: accept failed: %s", |
|
114 strerror(errno)); |
|
115 continue; |
|
116 } |
|
117 |
|
118 // TODO: read commands |
|
119 webserver_shutdown(); |
|
120 |
|
121 close(admin_client); |
|
122 |
|
123 break; |
|
124 } |
|
125 } |
103 } |
126 |
104 |
127 int main(int argc, char **argv) { |
105 int main(int argc, char **argv) { |
128 //test(); |
106 //test(); |
129 |
107 |