mirror of https://github.com/9001/r0c.git
flush writes to clients before socket shutdown
This commit is contained in:
parent
b751330fdd
commit
6dd4f7648a
|
@ -191,11 +191,7 @@ class VT100_Server(object):
|
|||
|
||||
with self.world.mutex:
|
||||
# Util.whoops("client part")
|
||||
try:
|
||||
remote.sck.shutdown(socket.SHUT_RDWR)
|
||||
remote.sck.close()
|
||||
except:
|
||||
pass
|
||||
Util.Daemon(Util.close_sck, "close_%s" % (remote.user.nick), (remote.sck,))
|
||||
|
||||
if announce:
|
||||
print(
|
||||
|
|
13
r0c/util.py
13
r0c/util.py
|
@ -4,6 +4,7 @@ from .__init__ import EP, PY2, WINDOWS, COLORS, INTERP, unicode
|
|||
|
||||
import traceback
|
||||
import threading
|
||||
import socket
|
||||
import struct
|
||||
import time
|
||||
import sys
|
||||
|
@ -635,6 +636,18 @@ def py26_threading_event_wait(event):
|
|||
event.wait = nice_meme
|
||||
|
||||
|
||||
def close_sck(sck):
|
||||
# could go fancy and grab the siocoutq stuff from copyparty but ehh
|
||||
try:
|
||||
sck.shutdown(socket.SHUT_WR)
|
||||
time.sleep(0.1)
|
||||
sck.shutdown(socket.SHUT_RDWR)
|
||||
except:
|
||||
pass
|
||||
finally:
|
||||
sck.close()
|
||||
|
||||
|
||||
"""
|
||||
# ---------------------------------------------------------------------
|
||||
# dumping ground for mostly useless code below
|
||||
|
|
Loading…
Reference in New Issue