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