[tor-dev] Migration of Tor Weather to Stem
Damian Johnson
atagar at torproject.org
Sat Jun 15 20:36:08 UTC 2013
> Hi,
>
> My name is Sreenatha. I've made an attempt to migrate Tor Weather
> from TorCtl to Stem as stated in my gsoc proposal(Module 2).
>
> Can you please take a look at the top 3 commits that I've made at my
> github account?
> Please suggest any additional changes that you think are necessary.
>
> Cheers,
> Sreenatha
>
> P.S : I am lucyd at OFTC on IRC.
Hi Sreenatha, glad that you've started in on this! We'd much prefer
for development discussions to be on tor-dev@ so looping that in.
This looks like a great start. I suspect there is a little confusion
though around the socket object that the Controller uses. The
Controller doesn't take a socket.socket instance, but rather a
stem.socket.ControlSocket...
https://stem.torproject.org/api/socket.html
This comes up a couple places, most notably...
https://github.com/lucyd/weather/commit/ff22e74c247bd61163a974329cd2feb2a121db94#L0R26
I doubt that function presently works. Rather, it should be...
def listen():
controller = Controller.from_port(port = config.control_port)
controller.authenticate(config.authenticator)
controller.add_event_listener(newconsensus_listener, EventType.NEWCONSENSUS)
I'm not sure what 'config.authenticator' is so that part might be
wrong. Also note that this creates a control socket then forgets about
it (Weather never cleans it up). This isn't a bug you've introduced
but rather what Weather already did. Not the end of the world
(interpreter shutdown will clean it up, though possibly with a
stacktrace about lingering threads).
Have you gotten a Weather instance up and running to test your changes?
Cheers! -Damian
More information about the tor-dev
mailing list