Prefer transport.abort()
This commit is contained in:
parent
c6093639b5
commit
cfb92a139f
@ -10,7 +10,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
import numbers
|
import numbers
|
||||||
import socket
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from lib.util import LoggedClass
|
from lib.util import LoggedClass
|
||||||
@ -152,7 +151,6 @@ class JSONRPC(asyncio.Protocol, LoggedClass):
|
|||||||
self.bandwidth_used = 0
|
self.bandwidth_used = 0
|
||||||
self.bandwidth_limit = 5000000
|
self.bandwidth_limit = 5000000
|
||||||
self.transport = None
|
self.transport = None
|
||||||
self.socket = None
|
|
||||||
# Parts of an incomplete JSON line. We buffer them until
|
# Parts of an incomplete JSON line. We buffer them until
|
||||||
# getting a newline.
|
# getting a newline.
|
||||||
self.parts = []
|
self.parts = []
|
||||||
@ -188,7 +186,6 @@ class JSONRPC(asyncio.Protocol, LoggedClass):
|
|||||||
'''Handle an incoming client connection.'''
|
'''Handle an incoming client connection.'''
|
||||||
self.transport = transport
|
self.transport = transport
|
||||||
self.peer_info = transport.get_extra_info('peername')
|
self.peer_info = transport.get_extra_info('peername')
|
||||||
self.socket = transport.get_extra_info('socket')
|
|
||||||
|
|
||||||
def connection_lost(self, exc):
|
def connection_lost(self, exc):
|
||||||
'''Handle client disconnection.'''
|
'''Handle client disconnection.'''
|
||||||
|
|||||||
@ -11,7 +11,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import codecs
|
import codecs
|
||||||
import json
|
import json
|
||||||
import socket
|
|
||||||
import ssl
|
import ssl
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
@ -514,13 +513,8 @@ class ServerManager(util.LoggedClass):
|
|||||||
stale = []
|
stale = []
|
||||||
for session in self.sessions:
|
for session in self.sessions:
|
||||||
if session.is_closing():
|
if session.is_closing():
|
||||||
if session.stop <= shutdown_cutoff and session.socket:
|
if session.stop <= shutdown_cutoff:
|
||||||
try:
|
session.transport.abort()
|
||||||
# Force shut down - a call to connection_lost
|
|
||||||
# should come soon after
|
|
||||||
session.socket.shutdown(socket.SHUT_RDWR)
|
|
||||||
except socket.error:
|
|
||||||
pass
|
|
||||||
elif session.last_recv < stale_cutoff:
|
elif session.last_recv < stale_cutoff:
|
||||||
self.close_session(session)
|
self.close_session(session)
|
||||||
stale.append(session.id_)
|
stale.append(session.id_)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user