flush writes to clients before socket shutdown

This commit is contained in:
ed 2023-10-10 00:22:23 +00:00
parent b751330fdd
commit 6dd4f7648a
2 changed files with 14 additions and 5 deletions

View File

@ -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(

View File

@ -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