So, I went through the events branch commit-by-commit and overall it looks very good. Three quick comments and I'll try to open sub-tickets for two other items.
I like that CIRC Event returns a fingerprint and nickname tuple in path. This was a minor bug in your personal TorCtl tree event handler that I just recently (this week) fixed for myself.
Is it possible that stem.StreamClosureReason values map to an interger starting with 1 (i.e. stem.StreamClosureReason.index_of(stem.StreamClosureReason.MISC) = 1). If so, I have written a Controller.close_stream method which could re-use stem.StreamClosureReason values for RELAY_END reason.
The commit titled "Revised behavior for document signature methods" is not relevant to events. It's not a big deal, but to avoid side effects merging this branch, maybe you could cherry-pick around it?
Trac: Username: robinson Status: needs_review to needs_revision
After my last comment, I noticed that there are two new commits on your events branch. To clarify my earlier examination of commits, I only reviewed through "Parsing AUTHDIR_NEWDESCS events" (commit 5b59e31ce1bcf23b).
Is it possible that stem.StreamClosureReason values map to an interger starting with 1...
Not unless we add a filler value at the start of the enum. I'd advise against using stem.StreamClosureReason indices, and instead use a dict that maps ints to stem.StreamClosureReason. The reason for this is less the offset that you mentioned, and more because StreamClosureReason includes 'END' and 'PRIVATE_ADDR'. Those are values allowed for in STREAM events, but not part of RELAY_END.
The commit titled "Revised behavior for document signature methods" is not relevant to events. It's not a big deal, but to avoid side effects merging this branch, maybe you could cherry-pick around it?
Good point. Cherry-picked fe16cce, pushed it to master, and rewrote my events branch to exclude it.
I'm swapping this back to the assigned status since I'm less than half way through the event types. I'll swap this back to 'needs review' when I'm done, though more code reviews as I go along would be very welcome.
Is it possible that stem.StreamClosureReason values map to an interger starting with 1...
[No]...because StreamClosureReason includes 'END' and 'PRIVATE_ADDR'. Those are values allowed for in STREAM events, but not part of RELAY_END.
On further reflection, I agree that StreamClosureReason should not be re-used for RELAY_END. I guess I'll rework my close_stream patch before submitting it. 8-)
I'm swapping this back to the assigned status since I'm less than half way through the event types. I'll swap this back to 'needs review' when I'm done, though more code reviews as I go along would be very welcome.
Please push the current event handling framework to the main Stem repository. Anyone else (read: me) wanting to develop event handler classes may find it easier to work against that repo. Any event handler classes you add will just be enhancements to the base event code.
On further reflection, I agree that StreamClosureReason should not be re-used for RELAY_END. I guess I'll rework my close_stream patch before submitting it. 8-)
Actually, after thinking about it maybe we could. StreamClosureReason is a superset of RELAY_END so maybe add a stem.RelayEnd enum and use it in the StreamClosureReason constructor? The close_stream() method could pretty easily account for the index offset.
Please push the current event handling framework to the main Stem repository.
Ok, will do later today. I was gonna wait until the feature branch was complete but if folks want to develop against it then I agree that it should be merged early.
That's all of the event types except STREAM_BW which is being tracked in another ticket. I'd like to resolve this one but trac won't let me do so while child tickets are active so this is pending those.
Children ticket are resolved so resolving this as well. Over the next couple days I'll be cleaning up the implementation a bit (there's quite a bit of redundant code), but there's probably no need to keep this ticket open for it.
Trac: Status: assigned to closed Resolution: N/Ato implemented