Commit Graph

557 Commits

Author SHA1 Message Date
Brian Warner
84749dd8b3 add misc/dump-timing.py too, to visualize the timeline 2016-03-01 18:23:19 -08:00
Brian Warner
8d82726c51 add DebugTiming object, --dump-timing= option
This writes timeline data to a .json file, which can be examined later
to find likely candidates for optimization.
2016-03-01 18:23:06 -08:00
Brian Warner
84def8a54b add some inlineCallbacks for simplicity
This control flow was getting too hairy.
2016-03-01 18:22:03 -08:00
Brian Warner
fd143caded tests.ServerBase: print message when threadpool is not idle
The previous commits improve test failures by dropping relay connections
at shutdown, and flunking a test quickly when one client fails but the
other one hangs.

If that doesn't work (say, some client has a time.sleep(), or other
stall that isn't affected by the relay shutdown), we'll be left with an
active thread holding that hanging client.

This patch adds a check to wormhole.test.common.ServerBase.tearDown that
looks for active threads, waits a second (after stopService), then
checks the threadpool again. If the threadpool is empty, everything is
fine. If not, it prints a message (to stdout) to inform the impatient
user why the test is probably hanging.
2016-03-01 17:07:48 -08:00
Brian Warner
b1dae14e6d test_scripts: handle hangs in one client
When test_scripts ran two clients at the same time, an error in one
could leave the other hanging (in a thread). One Deferred would errback,
the other would hang. Tests wait on one Deferred at a time, so if we're
unlucky and were waiting on the hanging Deferred (instead of the
erroring one), we'll wait forever, or at least until the default test
timeout of 180 seconds.

This adds an errback to notice when either client has errored, and
cancels the other Deferred, so it doesn't matter which one we wait upon
first.
2016-03-01 17:07:43 -08:00
Brian Warner
3fc3a563bf relay_server: disconnect clients upon shutdown 2016-03-01 17:07:37 -08:00
Brian Warner
0771aae7c7 server: Relay wasn't pruning channels
I forgot to hook it up to the service parent, so the timer was never
started.
2016-02-29 08:59:53 -08:00
Brian Warner
9293709e97 add NEWS for 0.6.3 release 2016-02-29 08:10:13 -08:00
Brian Warner
25ee48e989 add .coveragerc 2016-02-29 07:48:57 -08:00
Brian Warner
c225d57f8c cmd_receive_twisted.py: twisted-based implementation 2016-02-29 07:31:34 -08:00
Brian Warner
01064325a2 cmd_receive: refactor (slight message changes)
This prepares the way for a twisted-based implementation.
2016-02-29 07:30:40 -08:00
Brian Warner
6654efb429 move describe() from Transit to RecordPipe 2016-02-28 01:42:46 -08:00
Brian Warner
1903c58248 ipaddrs: return 127.0.0.1 if everything else fails
This helps the windows tests where ipaddrs currently fails entirely.
2016-02-27 17:37:12 -08:00
Brian Warner
ca06e95bbd test_blocking: avoid using real hints 2016-02-27 17:29:04 -08:00
Brian Warner
8067acbf82 cmd_receive: close the file before renaming
I'm always forgetting this one. It's more obvious on windows.
2016-02-27 17:20:43 -08:00
Brian Warner
f28f294138 first attempt at windows builds, with appveyor.com
The .appveyor.yml tells the tox.ini to install pypiwin32 directly,
rather than through a "twisted[windows]" extra. I wasn't able to get the
"extra" syntax to work properly under appyeyor, even though it worked ok
for me locally.

We use an extra "meta" tox environment to run "wormhole --version". This
confirms that versioneer is getting the right value, since we're now
running it from an installed sdist, rather than a checked-out git source
tree.
2016-02-27 16:11:02 -08:00
Brian Warner
ed1eb06ae8 blocking/transit: use descriptive error message 2016-02-27 14:48:12 -08:00
Brian Warner
1ff0792b32 test_scripts: prep for windows compatibility
newlines, os.mkfifo errors, JSON type differences
2016-02-27 14:46:38 -08:00
Brian Warner
cc9b2c574b tox: temporary workaround for twisted bug
Install twisted from git trunk until a release after twisted-15.5.0.
2016-02-27 14:43:33 -08:00
Brian Warner
101ac4c1af switch to tox for running tests 2016-02-27 14:39:56 -08:00
Brian Warner
14dcfeed73 tolerate lack of readline at runtime
'readline' is part of the python stdlib, so declaring a dependency on it
doesn't help. It doesn't exist on windows, and the pypi 'readline'
module doesn't work on windows. So instead, just attempt to import
readline, and if that fails, fall back to a non-completion flavor.
2016-02-27 14:16:58 -08:00
Brian Warner
b7319f90c8 windows "route.exe" is not absolute, and that's ok 2016-02-27 14:15:36 -08:00
Brian Warner
dbba482c62 cmd_receive_blocking.py: refactor 2016-02-17 21:35:53 -08:00
Brian Warner
e6fba34570 start on twisted receive: move old files into new homes 2016-02-17 19:25:19 -08:00
Brian Warner
7f056ca075 send-twisted: set transit key before sending phase1
This ensures that we'll be ready for them. Previously there was a race
between us revealing the direct hints to the peer, and us setting the
transit key (thus allowing us to check inbound handshake requests). The
Transit instance didn't handle the race, causing errors to be thrown
when the other side connected quickly.
2016-02-17 19:02:36 -08:00
Brian Warner
aa27bfd32c add twisted form of sender
Currently this is only invokable from tests.
2016-02-17 19:02:36 -08:00
Brian Warner
7ceffd783a add more assertions around transit_key 2016-02-17 19:02:35 -08:00
Brian Warner
3ffceff9d5 send-blocking: set transit key before sending phase1
This ensures that we'll be ready for them. Previously there was a race
between us revealing the direct hints to the peer, and us setting the
transit key (thus allowing us to check inbound handshake requests). The
Transit instance handles this race (with an interlock on the transit
key), but it's still nicer to do it cleanly.

This exposed a new race in Transit, where the inbound connection would
complete before transit.connect() had been called. The previous commit
adds an interlock to wait for that too. Until this change, the transit
key lock was covering that one up.
2016-02-17 19:02:35 -08:00
Brian Warner
142f3fc154 send-blocking: don't create Transit unless we need it 2016-02-17 19:02:35 -08:00
Brian Warner
dba42aff01 blocking transit: tolerate inbound connections before connect() starts 2016-02-17 19:02:35 -08:00
Brian Warner
369854b4cc test build_phase1_data 2016-02-17 18:07:35 -08:00
Brian Warner
79decea9ea rearrange scripts: make room for twisted 2016-02-17 16:26:03 -08:00
Brian Warner
d36d1cb063 runner.py: new approach to dispatching 2016-02-17 16:03:30 -08:00
Brian Warner
3b447df0f4 move argparser out to a separate module 2016-02-17 15:55:11 -08:00
Brian Warner
5d572137f4 improve test error message 2016-02-17 14:00:03 -08:00
Brian Warner
fd7d1b97d4 test scripts in a thread, not a subprocess, mostly 2016-02-17 14:00:01 -08:00
Brian Warner
903129f4a2 add --hide-progress, mostly for tests 2016-02-17 13:58:41 -08:00
Brian Warner
c5b2800a3e runner: strictly use cwd/stdout/stderr from 'args'
This will make it easier to test the scripts in a controlled fashion.
2016-02-17 13:53:20 -08:00
Brian Warner
e2f3bebe38 allow --relay-helper="" to disable relay
test_scripts now uses this to avoid accidentally using a relay
2016-02-17 13:53:18 -08:00
Brian Warner
d14d35f3cd cmd_send_blocking: close the transit when we're done 2016-02-17 13:52:26 -08:00
Brian Warner
5e928ac9f0 rewrite ProgressPrinter as a class, add tests 2016-02-17 12:46:12 -08:00
Brian Warner
00833a4bde test_scripts: factor out common test code 2016-02-17 10:22:31 -08:00
Brian Warner
99ff75259a catch 'send' of non-file/non-directory 2016-02-17 09:36:31 -08:00
Brian Warner
8079340bff more rearranging 2016-02-15 21:59:18 -08:00
Brian Warner
512c7c0a59 cmd_send: rearrange in preparation for twisted version 2016-02-15 21:40:57 -08:00
Brian Warner
a235b507c8 twisted.transit: implement producer/consumer flow control 2016-02-15 21:23:20 -08:00
Brian Warner
763d72f582 twisted.transit: implement Deferred-based receive_record() 2016-02-15 11:40:21 -08:00
Brian Warner
fb1461fa8c add twisted.transit, with tests 2016-02-14 17:57:09 -08:00
Brian Warner
7212e9e9f4 transit: split common code out to a new file
This will be shared between blocking.transit and the soon-to-land
twisted.transit .
2016-02-14 17:51:46 -08:00
Brian Warner
a1c4ef7279 document Transit protocol 2016-02-14 17:48:17 -08:00