mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2025-12-14 08:06:23 +08:00
Try to fix a bug in Unix
multiprocess bug of python in Unix operating system: The subprocess will not start when using 'fork' mode. This will make the UDP server down.
This commit is contained in:
@@ -20,7 +20,7 @@ import server.arclinkplay
|
||||
from udpserver.udp_main import link_play
|
||||
import os
|
||||
import sys
|
||||
from multiprocessing import Process, Pipe
|
||||
from multiprocessing import Process, Pipe, set_start_method
|
||||
|
||||
|
||||
from urllib.parse import parse_qs, urlparse
|
||||
@@ -899,6 +899,7 @@ def main():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
set_start_method("spawn")
|
||||
main()
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,11 @@ def create_room(conn, user_id, client_song_map):
|
||||
song_unlock = get_song_unlock(client_song_map)
|
||||
|
||||
conn.send((1, name, song_unlock))
|
||||
data = conn.recv()
|
||||
if conn.poll(10):
|
||||
data = conn.recv()
|
||||
else:
|
||||
data = (-1,)
|
||||
|
||||
if data[0] == 0:
|
||||
error_code = 0
|
||||
return error_code, {'roomCode': data[1],
|
||||
@@ -74,7 +78,11 @@ def join_room(conn, user_id, client_song_map, room_code):
|
||||
song_unlock = get_song_unlock(client_song_map)
|
||||
|
||||
conn.send((2, name, song_unlock, room_code))
|
||||
data = conn.recv()
|
||||
if conn.poll(10):
|
||||
data = conn.recv()
|
||||
else:
|
||||
data = (-1,)
|
||||
|
||||
if data[0] == 0:
|
||||
error_code = 0
|
||||
return error_code, {'roomCode': data[1],
|
||||
@@ -96,7 +104,11 @@ def update_room(conn, user_id, token):
|
||||
error_code = 108
|
||||
|
||||
conn.send((3, int(token)))
|
||||
data = conn.recv()
|
||||
if conn.poll(10):
|
||||
data = conn.recv()
|
||||
else:
|
||||
data = (-1,)
|
||||
|
||||
if data[0] == 0:
|
||||
error_code = 0
|
||||
return error_code, {'roomCode': data[1],
|
||||
|
||||
Reference in New Issue
Block a user