Skip to content

Instantly share code, notes, and snippets.

@achintangal
Last active August 29, 2015 13:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save achintangal/9002896 to your computer and use it in GitHub Desktop.
getting weather to communicate with stem
Feb 14 20:47:48.000 [debug] conn_read_callback(): socket 8 wants to read.
Feb 14 20:47:48.000 [debug] connection_handle_listener_read(): Connection accepted on socket 4 (child of fd 8).
Feb 14 20:47:48.000 [notice] New control connection opened.
Feb 14 20:47:48.000 [debug] connection_add_impl(): new conn type Control, socket 4, address 127.0.0.1, n_conns 3.
Feb 14 20:47:48.000 [debug] conn_read_callback(): socket 4 wants to read.
Feb 14 20:47:48.000 [debug] read_to_chunk(): Read 16 bytes. 16 on inbuf.
Feb 14 20:47:48.000 [debug] conn_write_callback(): socket 4 wants to write.
Feb 14 20:47:48.000 [debug] conn_read_callback(): socket 4 wants to read.
Feb 14 20:47:48.000 [debug] read_to_chunk(): Read 91 bytes. 91 on inbuf.
Feb 14 20:47:48.000 [debug] conn_write_callback(): socket 4 wants to write.
Feb 14 20:47:48.000 [debug] conn_read_callback(): socket 4 wants to read.
Feb 14 20:47:48.000 [debug] read_to_chunk(): Read 79 bytes. 79 on inbuf.
Feb 14 20:47:48.000 [info] handle_control_authenticate(): Authenticated control connection (4)
Feb 14 20:47:48.000 [debug] conn_write_callback(): socket 4 wants to write.
Feb 14 20:47:48.000 [debug] conn_read_callback(): socket 4 wants to read.
Feb 14 20:47:48.000 [debug] read_to_chunk(): Read 31 bytes. 31 on inbuf.
Feb 14 20:47:48.000 [debug] conn_write_callback(): socket 4 wants to write.
Feb 14 20:47:48.000 [debug] conn_read_callback(): socket 4 wants to read.
Feb 14 20:47:48.000 [debug] read_to_chunk(): Read 35 bytes. 35 on inbuf.
Feb 14 20:47:48.000 [debug] conn_write_callback(): socket 4 wants to write.
Feb 14 20:47:48.000 [debug] conn_read_callback(): socket 4 wants to read.
Feb 14 20:47:48.000 [debug] read_to_chunk(): Read 17 bytes. 17 on inbuf.
Feb 14 20:47:48.000 [debug] conn_write_callback(): socket 4 wants to write.
Feb 14 20:47:48.000 [debug] conn_read_callback(): socket 4 wants to read.
Feb 14 20:47:48.000 [debug] read_to_chunk(): Read 34 bytes. 34 on inbuf.
Feb 14 20:47:48.000 [debug] conn_write_callback(): socket 4 wants to write.
Feb 14 20:47:48.000 [debug] conn_read_callback(): socket 4 wants to read.
Feb 14 20:47:48.000 [debug] read_to_chunk(): Encountered eof on fd 4
Feb 14 20:47:48.000 [info] connection_control_reached_eof(): Control connection reached EOF. Closing.
Feb 14 20:47:48.000 [debug] conn_close_if_marked(): Cleaning up connection (fd 4).
def newconsensus_listener(event):
"""
Call C{updaters.run_all()} when a NEWCONSENSUS event is received.
@param event: The NEWCONSENSUS event. Not used by the function.
"""
logging.info('Got a new consensus. Updating router table and ' + \
'checking all subscriptions.')
updaters.run_all()
def listen():
"""Sets up a connection to Tor and initializes a controller to listen for
new consensus events.
"""
ctrl = Controller.from_port(port = config.control_port)
ctrl.authenticate(config.authenticator)
# ctrl.add_event_listener(newconsensus_listener, EventType.NEWCONSENSUS)
ctrl.add_event_listener(newconsensus_listener, EventType.BW)
print 'Listening for new consensus events.'
#logging.info('Listening for new consensus events.')
logging.info('Listening for new bw events.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment