Skip to content

Commit

Permalink
Merge pull request #370 from meejah/fix-controllerwait
Browse files Browse the repository at this point in the history
Fix CONTROLLER_WAIT event
  • Loading branch information
meejah authored Feb 16, 2023
2 parents 9d9339d + 212f064 commit 33b7e81
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
6 changes: 5 additions & 1 deletion test/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,11 @@ def test_progress_updates(self, ftb):
args = (50, "blarg", "Doing that thing we talked about.")
# kind-of cheating, test-wise?
ep._tor_progress_update(*args)
self.assertTrue(ding.called_with(*args))
ding.assert_called()
self.assertEqual(
ding.call_args[0][1:],
args[1:],
)

def test_progress_updates_error(self, ftb):
config = TorConfig()
Expand Down
3 changes: 2 additions & 1 deletion test/test_torstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,8 @@ def attach_stream(self, stream, circuits):
for ignored in self.state.event_map.items():
self.send(b"250 OK")

self.send(b"650 STREAM 1 NEW 0 ca.yahoo.com:80 SOURCE_ADDR=127.0.0.1:54327 PURPOSE=USER")
self.send(b"650 STREAM 1 NEW 0 links.duckduckgo.com:443 SOURCE_ADDR=127.0.0.1:54327 PURPOSE=USER")
self.send(b'650 STREAM 1 CONTROLLER_WAIT 0 links.duckduckgo.com:443 SOCKS_USERNAME="duckduckgo.com" SOCKS_PASSWORD="4a2f6ef74fe3aa0bf8876b4e927a28f7" CLIENT_PROTOCOL=SOCKS5 NYM_EPOCH=0 SESSION_GROUP=-5 ISO_FIELDS=SOCKS_USERNAME,SOCKS_PASSWORD,CLIENTADDR,SESSION_GROUP,NYM_EPOCH')
self.send(b"650 STREAM 1 REMAP 0 87.248.112.181:80 SOURCE=CACHE")
self.assertEqual(len(attacher.streams), 1)
self.assertEqual(attacher.streams[0].id, 1)
Expand Down
4 changes: 1 addition & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# stretch: 16.3.0-1

[tox]
envlist = clean,flake8,stats,readme_render,{py27,py36,py37,py38,py39,pypy}-{tx16,tx17,tx18,tx19,tx20},{py36,py37,py38,py39}-tx21
envlist = clean,flake8,stats,readme_render,{py27,py36,py37,py38,py39,pypy}-{tx18,tx19,tx20},{py36,py37,py38,py39}-tx21
# if you're not using detox, you can use this list to get
# "all environments" coverage stats:
# tox -e 'clean,flake8,py27-tx18,pypy-tx18,py35-tx18,stats'
Expand Down Expand Up @@ -40,8 +40,6 @@ deps=
coverage-lcov
toml # needed by above, but that doesn't declare it??
cryptography
tx16: twisted>=16.0.0,<17.0.0
tx17: twisted>=17.0.0,<18.0.0
tx18: twisted>=18.0.0,<19.0.0
tx19: twisted>=19.0.0,<20.0.0
tx20: twisted>=20.0.0,<21.0.0
Expand Down
2 changes: 1 addition & 1 deletion txtorcon/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ def is_ready(self):
"status/circuit-established",
)
returnValue(
not(
not (
int(info["dormant"]) or
not int(info["status/enough-dir-info"]) or
not int(info["status/circuit-established"])
Expand Down
3 changes: 3 additions & 0 deletions txtorcon/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ def update(self, args):
elif self.state in ['NEWRESOLVE', 'SENTRESOLVE']:
pass # print self.state, self, args

elif self.state == 'CONTROLLER_WAIT':
pass # waiting for us to ATTACHSTREAM

else:
raise RuntimeError("Unknown state: %s" % self.state)

Expand Down

0 comments on commit 33b7e81

Please sign in to comment.