diff options
author | Guido van Rossum <guido@python.org> | 1997-12-25 04:48:51 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-12-25 04:48:51 (GMT) |
commit | 643f8f62b4a81d8d842d530f54d83f7751b2fb6e (patch) | |
tree | 8ae077deddc7ed01e47265f963c0abe1da41e938 /Demo/pysvr | |
parent | ccb5ec62e10e8dce424f3f03159536bdc9c10d90 (diff) | |
download | cpython-643f8f62b4a81d8d842d530f54d83f7751b2fb6e.zip cpython-643f8f62b4a81d8d842d530f54d83f7751b2fb6e.tar.gz cpython-643f8f62b4a81d8d842d530f54d83f7751b2fb6e.tar.bz2 |
Add setsockopt...SO_REUSEADDR to avoid stupid waiting when killing and
restarting the server.
Diffstat (limited to 'Demo/pysvr')
-rw-r--r-- | Demo/pysvr/pysvr.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Demo/pysvr/pysvr.c b/Demo/pysvr/pysvr.c index b1397c9..e41d88e 100644 --- a/Demo/pysvr/pysvr.c +++ b/Demo/pysvr/pysvr.c @@ -111,6 +111,11 @@ main_thread(int port) exit(1); } +#ifdef SO_REUSEADDR + i = 1; + setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &i, sizeof i); +#endif + memset((char *)&addr, '\0', sizeof addr); addr.sin_family = AF_INET; addr.sin_port = htons(port); @@ -214,7 +219,6 @@ init_python() if (gtstate) return; Py_Initialize(); /* Initialize the interpreter */ - Py_Initialize(); /* Initialize the interpreter */ PyEval_InitThreads(); /* Create (and acquire) the interpreter lock */ gtstate = PyEval_SaveThread(); /* Release the thread state */ } |