當前位置: 首頁>>代碼示例>>Python>>正文


Python BaseServer.__init__方法代碼示例

本文整理匯總了Python中SocketServer.BaseServer.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python BaseServer.__init__方法的具體用法?Python BaseServer.__init__怎麽用?Python BaseServer.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SocketServer.BaseServer的用法示例。


在下文中一共展示了BaseServer.__init__方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from SocketServer import BaseServer [as 別名]
# 或者: from SocketServer.BaseServer import __init__ [as 別名]
def __init__(self, cmd = None, env_term = None):
		# Set Linux signal handler
		uname = commands.getoutput('uname')
		if uname == 'Linux':
			self.sigchldhandler = signal.signal(signal.SIGCHLD, signal.SIG_IGN)
		# Session
		self.session = {}
		self.cmd = cmd
		self.env_term = env_term
		# Synchronize methods
		self.lock = threading.RLock()
		for name in ['proc_keepalive', 'proc_buryall',
			'proc_read', 'proc_write', 'proc_dump', 'proc_getalive']:
			orig = getattr(self, name)
			setattr(self, name, SynchronizedMethod(self.lock, orig))
		# Supervisor thread
		self.signal_stop = 0
		self.thread = threading.Thread(target = self.proc_thread)
		self.thread.start() 
開發者ID:xypiie,項目名稱:WebShell,代碼行數:21,代碼來源:webshell.py

示例2: __init__

# 需要導入模塊: from SocketServer import BaseServer [as 別名]
# 或者: from SocketServer.BaseServer import __init__ [as 別名]
def __init__(self, server_address, handler_class, config,
                 bind_and_activate=True):
        # pylint: disable=super-init-not-called, non-parent-init-called
        # Init just BaseServer, TCPServer creates a socket.
        BaseServer.__init__(self, server_address, handler_class)

        if isinstance(server_address, socket.socket):
            # It's a bound and activates socket from systemd.
            self.socket = server_address
            bind_and_activate = False
        else:
            self.socket = socket.socket(self.address_family,
                                        self.socket_type)

        # copied from TCPServer
        if bind_and_activate:
            try:
                self.server_bind()
                self.server_activate()
            except BaseException:
                self.server_close()
                raise

        if self.socket.family == socket.AF_UNIX:
            self.socket_file = self.socket.getsockname()

        if 'consumers' not in config:
            raise ValueError('Configuration does not provide any consumer')
        self.config = config
        if 'server_string' in self.config:
            self.server_string = self.config['server_string']
        self.auditlog = log.auditlog 
開發者ID:latchset,項目名稱:custodia,代碼行數:34,代碼來源:server.py

示例3: __init__

# 需要導入模塊: from SocketServer import BaseServer [as 別名]
# 或者: from SocketServer.BaseServer import __init__ [as 別名]
def __init__(self, server_address, RequestHandlerClass):
        BaseServer.__init__(self, server_address, RequestHandlerClass)
        self.server_bind() 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:5,代碼來源:test_wsgiref.py

示例4: __init__

# 需要導入模塊: from SocketServer import BaseServer [as 別名]
# 或者: from SocketServer.BaseServer import __init__ [as 別名]
def __init__(self, server_address, RequestHandlerClass):
		from OpenSSL import SSL

		BaseServer.__init__(self, server_address, RequestHandlerClass)
		ctx = SSL.Context(SSL.SSLv3_METHOD)

		cert = os.path.join(settings.Config.ResponderPATH, settings.Config.SSLCert)
		key =  os.path.join(settings.Config.ResponderPATH, settings.Config.SSLKey)

		ctx.use_privatekey_file(key)
		ctx.use_certificate_file(cert)

		self.socket = SSL.Connection(ctx, socket.socket(self.address_family, self.socket_type))
		self.server_bind()
		self.server_activate() 
開發者ID:paranoidninja,項目名稱:piSociEty,代碼行數:17,代碼來源:HTTP.py


注:本文中的SocketServer.BaseServer.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。