def run(): """ The run method is what actually spawns and manages blackhole. """ signal.signal(signal.SIGTERM, terminate) action = set_action() set_options() # Grab the sockets early for multiprocessing if action in ('start',): socks = sockets() setgid() setuid() d = daemon(action) # Change group and user io_loop = fork() # Iterate over the dictionary of socket connections # and add them to the IOLoop for _, sock in socks.iteritems(): callback = functools.partial(connection_ready, sock) io_loop.add_handler(sock.fileno(), callback, io_loop.READ) try: io_loop.start() except (KeyboardInterrupt, SystemExit): io_loop.stop() d.stop() sys.exit(0)
def run(): """ The run method is what actually spawns and manages blackhole. """ signal.signal(signal.SIGTERM, terminate) action = set_action() set_options() # Grab the sockets early for multiprocessing if action in ('start', ): socks = sockets() setgid() setuid() d = daemon(action) # Change group and user io_loop = fork() # Iterate over the dictionary of socket connections # and add them to the IOLoop for _, sock in socks.iteritems(): callback = functools.partial(connection_ready, sock) io_loop.add_handler(sock.fileno(), callback, io_loop.READ) try: io_loop.start() except (KeyboardInterrupt, SystemExit): io_loop.stop() d.stop() sys.exit(0)
def setUp(self): super(TestSSLSocketIsNotSet, self).setUp() options.ssl = False self.sockets = sockets()
def setUp(self): super(TestSSLSocketIsSet, self).setUp() options.ssl = True self.sockets = sockets()
def setUp(self): super(TestSocketIsSet, self).setUp() self.ssl = False self.sockets = sockets()