[tor-bugs] #9485 [Pluggable transport]: Cleanup of pyptlib internals

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Aug 14 16:14:49 UTC 2013


#9485: Cleanup of pyptlib internals
---------------------------------+------------------------------------------
 Reporter:  infinity0            |          Owner:  asn
     Type:  defect               |         Status:  new
 Priority:  normal               |      Milestone:     
Component:  Pluggable transport  |        Version:     
 Keywords:  pyptlib              |         Parent:     
   Points:                       |   Actualpoints:     
---------------------------------+------------------------------------------
 The current code has a few issues:
 - parses config for every method call
 - uses implicit global state (awkward to test)
 - writes unconditionally to stdout (awkward to test)
 - mixes config logic with write/decision logic
 - inconsistent method names (writeMethod vs reportSuccess)

 My refactoring deals with these issues. Currently it preserves the current
 API but deprecates it in favour of the new API and documents an easy
 transition path.

 https://github.com/infinity0/pyptlib/compare/master...api-config

 Old API (still supported; marked deprecated):

 {{{
 pyptlib.client.init(transports)
 pyptlib.client.reportSuccess(...)
 pyptlib.client.reportEnd()
 }}}

 New API:

 {{{
 client = pyptlib.client.ClientTransportPlugin.fromEnv()
 client.init(transports)
 client.reportMethodSuccess(...)
 client.reportMethodsEnd()
 }}}

 Similar sort of thing for the server.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9485>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list