summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Replace _read_reply with stem.types.ControlMessagestem-integrationDamian Johnson2011-10-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Dropping TorCtl's _read_reply and unescape_dots in favor of stem's ControlMessage object. This should be largely transparent to users, the only visible impact being... - The _read_reply method now only raises TorCtlClosed or TorCtlError exceptions, not socket.error (which was a pita to catch since it's not a subclass of TorCtlError). Exception messages differ. - TorCtl would strip trailing whitespace from the content, stem preserves it. - When TorCtl.Connection._loop encountered a CLOSE message it would set the socket (self._s) to None. I'm not sure why it was doing that, and troubling since it didn't make any effort to close the socket. I've removed it. - The behavior of stem in the case of malformed tor responses differs... - Both stem and TorCtl read lines with \n terminators, though stem will raise a ProtocolError if it lacks a \r\n ending while TorCtl would accept it. - When reading a data block with an unescaped leading period TorCtl would strip it off (ie ". my line" would become " my line"). I'm not spotting how we're supposed to handle this in the control-spec so I'm leaving the period alone (I wonder if I should raise a ProtocolError instead...). This also removes the BufSock class, which was largely unneeded. The socket object has a makefile() method, which provides a file with a readline() method. Using this not only simplifies the code but likely gives some performance advantages. The stem.types.ControlMessage class and parser have both unit and integration tests - suggestions welcome if you spot something I missed. I've done manual tests for the TorCtl integration and also exercised it by running arm.
* Document a pythonism that briefly confused Aaron and me.Mike Perry2011-10-04
|
* 4024 - get_git_version does not work for submoduleaagbsn2011-09-30
| | | | Added support for detached heads
* use local sessionsaagbsn2011-09-04
| | | | | | | see: http://www.sqlalchemy.org/docs/orm/session.html#lifespan-of-a-contextual-session "This has the effect such that each web request starts fresh with a brand new session, and is the most definitive approach to closing out a request."
* NOTICE when git repo not found rather than ERRORaagbsn2011-09-01
|
* add function to get current branch and headaagbsn2011-08-31
|
* remove ;aagbsn2011-08-31
|
* use Elixir model delete methodaagbsn2011-08-31
| | | | | | | try to use the same session for deletes and queries where possible, this may be the cause of an ObjectNotFound exception that occurs right after _update_db(), despite the Router object being in the consensus and also in the db.
* placeholder for call to refresh_all()aagbsn2011-08-01
| | | | | | suspicious session behavior may require refreshing all objects in order to keep tc_session and sessions bound to Elixir synchronized
* WARN when circ_status_event fails to query Routeraagbsn2011-08-01
|
* Merge branch 'ratio-restrictions'Mike Perry2011-06-27
|\
| * Implement ratio ranking support.Mike Perry2011-06-24
| |
* | Allow TorCtl.connect() to specify alternate Connection classes.Mike Perry2011-06-25
|/ | | | Need to move it for that...
* Add a little more rambling to reset_all().Mike Perry2011-06-24
|
* Merge remote branch 'aagbsn/testing'Mike Perry2011-06-24
|\
| * Added refresh_all() and warnings to reset_all()aagbsn2011-06-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SQLSupport.refresh_all() is required to keep Elixir and tc_session in sync. Otherwise it is possible for routers added by the consensus update to not show up in queries using the Elixir model i.e. Router.query.all() Also, warnings have been added to SQLSupport.reset_all() because this does not work properly -- in some cases relation tables were not being reset properly (this resulted in old bw measurements being repeated in future output!). Finally, even when reset_all() works properly, bwauthority memory usage continues to grow.
| * update consensus after resetting stats within the same jobaagbsn2011-06-23
| |
| * added reset_stats() to Scansupport.pyaagbsn2011-06-23
| | | | | | | | | | | | | | | | calls parent and SQLSupport reset functions Tests show that SQLSupport.reset_all() may clear too much because if BwAuthority calls Scansupport.reset_stats() after each speedrace() run only the first slice is properly recorded; the rest are empty. See: https://trac.torproject.org/projects/tor/ticket/2947
| * add case for longaagbsn2011-06-18
| |
| * generalize db message, we now support postgres and mysql tooaagbsn2011-06-17
| |
| * fixes for divide-by-zerosaagbsn2011-06-17
| | | | | | | | | | | | Postgres doesn't ignore divide-by-zeros like MySQL CASE statement added to set the result to NULL if the denominator is zero
| * rewrite query for mysql compatibility attempt 2aagbsn2011-06-17
| | | | | | | | this actually appears to work
| * rewrite query for mysql compatibility attempt 1aagbsn2011-06-17
| |
| * backward compatibility with SQLAlchemy 0.5.xaagbsn2011-06-17
| |
| * SQLAlchemey and Elixir upgradeaagbsn2011-06-17
| | | | | | | | | | | | | | enabled elixir migration aid options. renamed a few function calls, as per SQLAlchemy upgrade docs: session.clear() is removed. use session.remove_all()
* | Eliminate a warn about a consensus miscount.Mike Perry2011-06-24
| | | | | | | | By fixing the miscount, of course.
* | Remove python 2.5ismMike Perry2011-06-20
|/
* Rename make_connection to preauth_connect and export it.Mike Perry2011-06-17
|
* Rename connectionComp and export ns_body_iter.Mike Perry2011-06-17
|
* Add iterator support to get_consensus().Mike Perry2011-06-17
| | | | Also rename getIterator to get_iterator.
* Merge remote branch 'atagar/bug2812'Mike Perry2011-06-17
|\
| * Merge commit '40f7cbc' into bug2812bug2812Damian Johnson2011-06-16
| |\ | | | | | | | | | | | | Conflicts: TorUtil.py
| | * Closing connection in case of auth failurebug3409Damian Johnson2011-06-16
| | | | | | | | | | | | | | | When authentication failed in TorCtl.connect() the abandoned connection wasn't being closed.
| | * TorCtl connect method inflexibleDamian Johnson2011-06-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The connect method is a nice helper for cli initiation, but lacks sufficient call visibility to help in more general use cases. In particular it... - sends feedback to stdout - prompts for the controller password on stdin - suppresses exceptions To get around this I'm adding a more generic 'connectionComp' that does the icky bits of the connection negotiation I was trying to hide while still giving the caller what it needs to handle the connection process however it'd like. Tested by exercising the connect functionality with cookies, password, and connection components to handle my TBB cookie auth renegotiation fix.
| | * Option to get get_network_status as an iteratorbug3406Damian Johnson2011-06-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting the 'getIterator' argument drops the memory usage of calling get_network_status by 71% (from 3.5 MB to 1 MB). This is still higher than what I was expecting from a generator, though certainly much better. Unfortunately this didn't have an impact on the ConsensusTracker. The memory usage from its constructor dwarfs anything else I've looked at (18.8 MB) and didn't drop like I'd expect when consensus_only was false. :(
| | * Handling for connections to non-control socketsbug2580Damian Johnson2011-06-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we attempt to initiate a control connection to a non-control port (for instance tor's socks port instead)... - the socket shutdown issues an error since it's not connected yet - checking the authentication type fails with a TorCtlClosed rather than error reply For more information see bug 2580.
| | * Unblocking waits for a response when we errorbug1329Damian Johnson2011-06-13
| | | | | | | | | | | | | | | When the signal sent by _sendImpl causes the control connection to close we block indefinitely waiting for a response. For more information see bug 1329.
* | | Merge branch 'bug2812'Mike Perry2011-06-16
|\ \ \ | |/ / | | / | |/ |/|
| * Removing socket timeout for thread wakeupDamian Johnson2011-06-16
| | | | | | | | | | The shutdown added in this branch wakes the socket so there's no need for the loop we previously had.
* | Replacing old TorCtl example with a BW listenerbug2065Damian Johnson2011-06-12
|/ | | | | Event listening, particularly BW events, is a common request on irc so using it as the TorCtl example. For more information see bug 2065.
* Shutting down sockets when closedDamian Johnson2011-06-12
| | | | | Each TorCtl instance spawned a socket that would continue to live for the life of the python process. For more information see ticket 2812.
* Removing indefinite blocking on socket recvbug2412Damian Johnson2011-06-12
| | | | | | When shutting down we can't join on _thread unless the socket receives data because we didn't have a timeout. This issues a 20 ms timeout on socket reads and cleans up _thread when we close.
* Fix some issues with SmartSocket.Mike Perry2011-03-07
| | | | Also remove some traceback debugging statements.
* Try to catch an AttributeError early..Mike Perry2011-03-03
| | | | It may be silently killing the bwauths on some platforms..
* Damnit all to hell.Mike Perry2011-02-25
|
* Use isinstance rather than "is type()" for type checks.Mike Perry2011-02-25
|
* Merge remote branch 'chiiph/master'Mike Perry2011-02-25
|\
| * logfile can be unicode tooTomas Touceda2011-02-25
| |
* | Fix a python 2.5 traceback in recent 'body' commit.Mike Perry2011-02-24
| |
* | Merge branch 'chiiph'Mike Perry2011-02-23
|\ \ | |/