Skip to content

Commit 177c639

Browse files
author
clowwindy
committed
fix graceful restart test
1 parent b28de8e commit 177c639

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

shadowsocks/udprelay.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@ def handle_event(self, sock, fd, event):
274274
def handle_periodic(self):
275275
if self._closed:
276276
if self._server_socket:
277-
logging.info('closed UDP port %d', self._listen_port)
278277
self._server_socket.close()
279278
self._server_socket = None
280279
for sock in self._sockets:
281280
sock.close()
281+
logging.info('closed UDP port %d', self._listen_port)
282282
self._cache.sweep()
283283
self._client_fd_to_server_addr.sweep()
284284

tests/graceful.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"server":"127.0.0.1",
3-
"server_port":8387,
3+
"server_port":8388,
44
"local_port":1081,
55
"password":"aes_password",
66
"timeout":15,

tests/test_graceful_restart.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ sleep 1
2323

2424
# graceful restart server: send SIGQUIT to old process and start a new one
2525
kill -s SIGQUIT $SERVER
26+
sleep 0.5
2627
$PYTHON shadowsocks/server.py -c tests/graceful.json --forbidden-ip "" &
2728
NEWSERVER=$!
2829

@@ -37,7 +38,7 @@ echo old server running: $OLD_SERVER_RUNNING1
3738
sleep 1
3839

3940
# close connections on old server
40-
kill -s SIGINT $GCLI
41+
kill -s SIGKILL $GCLI
4142
kill -s SIGKILL $GSERVER
4243
kill -s SIGINT $LOCAL
4344

@@ -49,6 +50,7 @@ OLD_SERVER_RUNNING2=$?
4950
# old server should quit at this moment
5051
echo old server running: $OLD_SERVER_RUNNING2
5152

53+
kill -s SIGINT $SERVER
5254
# new server is expected running
5355
kill -s SIGINT $NEWSERVER || exit 1
5456

@@ -57,7 +59,6 @@ if [ $OLD_SERVER_RUNNING1 -ne 0 ]; then
5759
fi
5860

5961
if [ $OLD_SERVER_RUNNING2 -ne 1 ]; then
60-
kill -s SIGINT $SERVER
6162
sleep 1
6263
exit 1
6364
fi

0 commit comments

Comments
 (0)