transports = []
if native_port: transports.append( NativeServer(shared, abe, sb, config.get('server','banner'), host, int(native_port)) )
if stratum_tcp_port: transports.append( TcpServer(dispatcher, host, int(stratum_tcp_port)) )
- if stratum_http_port: transports.append( HttpServer(dispatcher, host, int(stratum_http_port)) )
+ if stratum_http_port: transports.append( HttpServer(dispatcher, host, int(stratum_http_port), password) )
for server in transports:
server.start()
self.pending_responses.append(response)
class HttpServer(threading.Thread):
- def __init__(self, dispatcher, host, port):
+ def __init__(self, dispatcher, host, port, password):
self.shared = dispatcher.shared
self.dispatcher = dispatcher.request_dispatcher
threading.Thread.__init__(self)
self.daemon = True
self.host = host
self.port = port
+ self.password = password
self.lock = threading.Lock()
def run(self):
self.dispatcher.process(session, request)
def do_stop(self, session, request):
- self.shared.stop()
- return 'ok'
+ try:
+ password = request['params'][0]
+ except:
+ password = None
+ if password == self.password:
+ self.shared.stop()
+ return 'ok'