updated socketserver to 2/3 compliant

This commit is contained in:
bharnden 2019-05-05 21:37:45 -07:00
parent 1e98175e35
commit b58d32c156
2 changed files with 9 additions and 9 deletions

View file

@ -3,11 +3,11 @@ socket server request handlers leveraged by core servers.
"""
import Queue
import SocketServer
import logging
import os
import shlex
import shutil
import socketserver
import sys
import threading
import time
@ -44,9 +44,9 @@ from core.services.coreservices import ServiceManager
from core.services.coreservices import ServiceShim
class CoreHandler(SocketServer.BaseRequestHandler):
class CoreHandler(socketserver.BaseRequestHandler):
"""
The SocketServer class uses the RequestHandler class for servicing requests.
The CoreHandler class uses the RequestHandler class for servicing requests.
"""
def __init__(self, request, client_address, server):
@ -92,7 +92,7 @@ class CoreHandler(SocketServer.BaseRequestHandler):
self.coreemu = server.coreemu
utils.close_onexec(request.fileno())
SocketServer.BaseRequestHandler.__init__(self, request, client_address, server)
socketserver.BaseRequestHandler.__init__(self, request, client_address, server)
def setup(self):
"""
@ -140,7 +140,7 @@ class CoreHandler(SocketServer.BaseRequestHandler):
logging.info("no session clients left and not active, initiating shutdown")
self.coreemu.delete_session(self.session.id)
return SocketServer.BaseRequestHandler.finish(self)
return socketserver.BaseRequestHandler.finish(self)
def session_message(self, flags=0):
"""

View file

@ -2,12 +2,12 @@
Defines core server for handling TCP connections.
"""
import SocketServer
import socketserver
from core.emulator.coreemu import CoreEmu
class CoreServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
class CoreServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
"""
TCP server class, manages sessions and spawns request handlers for
incoming connections.
@ -18,7 +18,7 @@ class CoreServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
def __init__(self, server_address, handler_class, config=None):
"""
Server class initialization takes configuration data and calls
the SocketServer constructor
the socketserver constructor.
:param tuple[str, int] server_address: server host and port to use
:param class handler_class: request handler
@ -27,4 +27,4 @@ class CoreServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
"""
self.coreemu = CoreEmu(config)
self.config = config
SocketServer.TCPServer.__init__(self, server_address, handler_class)
socketserver.TCPServer.__init__(self, server_address, handler_class)