| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
| |
Added support for detached heads
|
| |
|
|
|
|
|
| |
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."
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
suspicious session behavior may require refreshing all
objects in order to keep tc_session and sessions bound
to Elixir synchronized
|
| | |
|
| |\ |
|
| | | |
|
| |/
|
|
| |
Need to move it for that...
|
| | |
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| | |
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
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| | |
Postgres doesn't ignore divide-by-zeros like MySQL
CASE statement added to set the result to NULL if
the denominator is zero
|
| | |
| |
| |
| | |
this actually appears to work
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| | |
enabled elixir migration aid options.
renamed a few function calls, as per SQLAlchemy upgrade docs:
session.clear() is removed. use session.remove_all()
|
| | |
| |
| |
| | |
By fixing the miscount, of course.
|
| |/ |
|
| | |
|
| | |
|
| |
|
|
| |
Also rename getIterator to get_iterator.
|
| |\ |
|
| | |\
| | |
| | |
| | |
| | | |
Conflicts:
TorUtil.py
|
| | | |
| | |
| | |
| | |
| | | |
When authentication failed in TorCtl.connect() the abandoned connection wasn't
being closed.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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. :(
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | |
| | |
| | |
| | |
| | | |
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.
|
| |\ \ \
| |/ /
| | /
| |/
|/| |
|
| | |
| |
| |
| |
| | |
The shutdown added in this branch wakes the socket so there's no need for the
loop we previously had.
|
| |/
|
|
|
| |
Event listening, particularly BW events, is a common request on irc so using it
as the TorCtl example. For more information see bug 2065.
|
| |
|
|
|
| |
Each TorCtl instance spawned a socket that would continue to live for the life
of the python process. For more information see ticket 2812.
|
| |
|
|
|
|
| |
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.
|
| |
|
|
| |
Also remove some traceback debugging statements.
|
| |
|
|
| |
It may be silently killing the bwauths on some platforms..
|
| | |
|
| | |
|
| |\ |
|
| | | |
|
| | | |
|
| |\ \
| |/ |
|