Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Core
Tor
Commits
4abfcb79
Unverified
Commit
4abfcb79
authored
5 years ago
by
teor
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5
parents
0e2834a3
cf2b00d3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changes/bug31837
+5
-0
5 additions, 0 deletions
changes/bug31837
src/test/test_rebind.py
+9
-7
9 additions, 7 deletions
src/test/test_rebind.py
with
14 additions
and
7 deletions
changes/bug31837
0 → 100644
+
5
−
0
View file @
4abfcb79
o Minor bugfixes (testing):
- When testing port rebinding, don't busy-wait for tor to log. Instead,
actually sleep for a short time before polling again. Also improve the
formatting of control commands and log messages.
Fixes bug 31837; bugfix on 0.3.5.1-alpha.
This diff is collapsed.
Click to expand it.
src/test/test_rebind.py
+
9
−
7
View file @
4abfcb79
...
...
@@ -31,15 +31,17 @@ def wait_for_log(s):
cutoff
=
time
.
time
()
+
LOG_TIMEOUT
while
time
.
time
()
<
cutoff
:
l
=
tor_process
.
stdout
.
readline
()
l
=
l
.
decode
(
'
utf8
'
)
l
=
l
.
decode
(
'
utf8
'
,
'
backslashreplace
'
)
if
s
in
l
:
logging
.
info
(
'
Tor logged:
"
{}
"'
.
format
(
l
.
strip
()))
return
logging
.
info
(
'
Tor logged:
"
{}
"
, waiting for
"
{}
"'
.
format
(
l
.
strip
(),
s
))
# readline() returns a blank string when there is no output
# avoid busy-waiting
if
len
(
s
)
==
0
:
if
len
(
l
)
==
0
:
logging
.
debug
(
'
Tor has not logged anything, waiting for
"
{}
"'
.
format
(
s
))
time
.
sleep
(
LOG_WAIT
)
else
:
logging
.
info
(
'
Tor logged:
"
{}
"
, waiting for
"
{}
"'
.
format
(
l
.
strip
(),
s
))
fail
(
'
Could not find
"
{}
"
in logs after {} seconds
'
.
format
(
s
,
LOG_TIMEOUT
))
def
pick_random_port
():
...
...
@@ -119,18 +121,18 @@ if control_socket.connect_ex(('127.0.0.1', control_port)):
tor_process
.
terminate
()
fail
(
'
Cannot connect to ControlPort
'
)
control_socket
.
sendall
(
'
AUTHENTICATE
\r\n
'
.
encode
(
'
utf8
'
))
control_socket
.
sendall
(
'
SETCONF SOCKSPort=0.0.0.0:{}
\r\n
'
.
format
(
socks_port
).
encode
(
'
utf8
'
))
control_socket
.
sendall
(
'
AUTHENTICATE
\r\n
'
.
encode
(
'
ascii
'
))
control_socket
.
sendall
(
'
SETCONF SOCKSPort=0.0.0.0:{}
\r\n
'
.
format
(
socks_port
).
encode
(
'
ascii
'
))
wait_for_log
(
'
Opened Socks listener
'
)
try_connecting_to_socksport
()
control_socket
.
sendall
(
'
SETCONF SOCKSPort=127.0.0.1:{}
\r\n
'
.
format
(
socks_port
).
encode
(
'
utf8
'
))
control_socket
.
sendall
(
'
SETCONF SOCKSPort=127.0.0.1:{}
\r\n
'
.
format
(
socks_port
).
encode
(
'
ascii
'
))
wait_for_log
(
'
Opened Socks listener
'
)
try_connecting_to_socksport
()
control_socket
.
sendall
(
'
SIGNAL HALT
\r\n
'
.
encode
(
'
utf8
'
))
control_socket
.
sendall
(
'
SIGNAL HALT
\r\n
'
.
encode
(
'
ascii
'
))
wait_for_log
(
'
exiting cleanly
'
)
logging
.
info
(
'
OK
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment