uwsgi.c做了什么
core/uwsgi.c:
...
// !!!初始化socket协议!!!
// initialize socket protocols (do it after caching !!!)
uwsgi_protocols_register();
...
// !!! 绑定所有未绑定的socket !!!
uwsgi_bind_sockets();
// put listening socket in non-blocking state and set the protocol
uwsgi_set_sockets_protocols();
...
// initialize request plugin only if workers or master are available
if (uwsgi.sockets || uwsgi.master_process || uwsgi.no_server || uwsgi.command_mode || uwsgi.loop) {
for (i = 0; i < 256; i++) {
if (uwsgi.p[i]->init) {
uwsgi.p[i]->init();
}
}
}
...
if (uwsgi.has_threads) {
...
// again check for workers/sockets...
if (uwsgi.sockets || uwsgi.master_process || uwsgi.no_server || uwsgi.command_mode || uwsgi.loop) {
for (i = 0; i < 256; i++) {
if (uwsgi.p[i]->enable_threads)
uwsgi.p[i]->enable_threads();
}
}
}
...
//init apps hook (if not lazy)
if (!uwsgi.lazy && !uwsgi.lazy_apps) {
uwsgi_init_all_apps();
}
...
if (!uwsgi.status.is_cheap) {
if (uwsgi.cheaper && uwsgi.cheaper_count) {
int nproc = uwsgi.cheaper_initial;
if (!nproc)
nproc = uwsgi.cheaper_count;
for (i = 1; i <= uwsgi.numproc; i++) {
if (i <= nproc) {
if (uwsgi_respawn_worker(i))
break;
uwsgi.respawn_delta = uwsgi_now();
}
else {
uwsgi.workers[i].cheaped = 1;
}
}
}
...
}
uwsgi_start中uwsgi_protocols_register做了什么
主要是初始化socket协议