Skip to content

Commit

Permalink
Force socket shutdown before close (#2607)
Browse files Browse the repository at this point in the history
Co-authored-by: Zhiwei <zhi.wei.liang@outlook.com>
  • Loading branch information
ahopkins and ChihweiLHBird committed Nov 29, 2022
1 parent 4c14910 commit aef2673
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sanic/mixins/startup.py
Expand Up @@ -19,7 +19,7 @@
from multiprocessing import Manager, Pipe, get_context
from multiprocessing.context import BaseContext
from pathlib import Path
from socket import socket
from socket import SHUT_RDWR, socket
from ssl import SSLContext
from typing import (
TYPE_CHECKING,
Expand Down Expand Up @@ -864,6 +864,7 @@ def serve(

sync_manager.shutdown()
for sock in socks:
sock.shutdown(SHUT_RDWR)
sock.close()
socks = []
trigger_events(main_stop, loop, primary)
Expand Down

0 comments on commit aef2673

Please sign in to comment.