Kaydet (Commit) 643f8f62 authored tarafından Guido van Rossum's avatar Guido van Rossum

Add setsockopt...SO_REUSEADDR to avoid stupid waiting when killing and

restarting the server.
üst ccb5ec62
...@@ -111,6 +111,11 @@ main_thread(int port) ...@@ -111,6 +111,11 @@ main_thread(int port)
exit(1); exit(1);
} }
#ifdef SO_REUSEADDR
i = 1;
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &i, sizeof i);
#endif
memset((char *)&addr, '\0', sizeof addr); memset((char *)&addr, '\0', sizeof addr);
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
addr.sin_port = htons(port); addr.sin_port = htons(port);
...@@ -214,7 +219,6 @@ init_python() ...@@ -214,7 +219,6 @@ init_python()
if (gtstate) if (gtstate)
return; return;
Py_Initialize(); /* Initialize the interpreter */ Py_Initialize(); /* Initialize the interpreter */
Py_Initialize(); /* Initialize the interpreter */
PyEval_InitThreads(); /* Create (and acquire) the interpreter lock */ PyEval_InitThreads(); /* Create (and acquire) the interpreter lock */
gtstate = PyEval_SaveThread(); /* Release the thread state */ gtstate = PyEval_SaveThread(); /* Release the thread state */
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment