added --freebind option (Linux only)

This commit is contained in:
roberto@dexter
2011-07-22 13:11:14 +02:00
parent d590a189ed
commit 43d89b2eaf
3 changed files with 18 additions and 0 deletions
+11
View File
@@ -500,6 +500,17 @@ int bind_to_tcp(char *socket_name, int listen_queue, char *tcp_port) {
uwsgi_nuclear_blast();
}
#ifdef __linux__
#ifdef IP_FREEBIND
if (uwsgi.freebind) {
if (setsockopt(serverfd, SOL_IP, IP_FREEBIND, (const void *) &uwsgi.freebind, sizeof(int)) < 0) {
uwsgi_error("setsockopt()");
uwsgi_nuclear_blast();
}
}
#endif
#endif
if (uwsgi.reuse_port) {
#ifdef SO_REUSEPORT
if (setsockopt(serverfd, SOL_SOCKET, SO_REUSEPORT, (const void *) &uwsgi.reuse_port, sizeof(int)) < 0) {
+3
View File
@@ -57,6 +57,9 @@ static struct option long_base_options[] = {
{"abstract-socket", no_argument, 0, 'a'},
{"chmod-socket", optional_argument, 0, 'C'},
{"chown-socket", required_argument, 0, LONG_ARGS_CHOWN_SOCKET},
#ifdef __linux__
{"freebind", no_argument, &uwsgi.freebind, 1},
#endif
{"map-socket", required_argument, 0, LONG_ARGS_MAP_SOCKET},
{"chmod", optional_argument, 0, 'C'},
#ifdef UWSGI_THREADING
+4
View File
@@ -1095,6 +1095,10 @@ struct uwsgi_server {
struct timeval start_tv;
int abstract_socket;
#ifdef __linux__
int freebind;
#endif
int chmod_socket;
char *chown_socket;
mode_t chmod_socket_value;