Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sbws
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
Releases
Container Registry
Model registry
Operate
Environments
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
juga
sbws
Commits
c7a7a7a3
Commit
c7a7a7a3
authored
6 years ago
by
Matt Traudt
Browse files
Options
Downloads
Patches
Plain Diff
Set socket timeout in globals; use it
parent
38f843bf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
sbws/commands/client.py
+2
-2
2 additions, 2 deletions
sbws/commands/client.py
sbws/commands/server.py
+2
-0
2 additions, 0 deletions
sbws/commands/server.py
sbws/globals.py
+1
-0
1 addition, 0 deletions
sbws/globals.py
with
5 additions
and
2 deletions
sbws/commands/client.py
+
2
−
2
View file @
c7a7a7a3
...
...
@@ -10,7 +10,7 @@ from ..lib.relayprioritizer import RelayPrioritizer
from
..lib.helperrelay
import
HelperRelayList
from
..util.simpleauth
import
authenticate_to_server
from
sbws.globals
import
(
fail_hard
,
is_initted
)
from
sbws.globals
import
(
MIN_REQ_BYTES
,
MAX_REQ_BYTES
)
from
sbws.globals
import
(
MIN_REQ_BYTES
,
MAX_REQ_BYTES
,
SOCKET_TIMEOUT
)
import
sbws.util.stem
as
stem_utils
from
stem.control
import
EventType
from
argparse
import
ArgumentDefaultsHelpFormatter
...
...
@@ -32,7 +32,7 @@ def make_socket(socks_host, socks_port):
the socket hasn
'
t connect()ed anywhere
'''
s
=
socks
.
socksocket
()
s
.
set_proxy
(
socks
.
PROXY_TYPE_SOCKS5
,
socks_host
,
socks_port
)
s
.
settimeout
(
10
)
s
.
settimeout
(
SOCKET_TIMEOUT
)
return
s
...
...
This diff is collapsed.
Click to expand it.
sbws/commands/server.py
+
2
−
0
View file @
c7a7a7a3
from
..util.simpleauth
import
authenticate_client
from
..util.sockio
import
read_line
from
sbws.globals
import
(
fail_hard
,
is_initted
)
from
sbws.globals
import
SOCKET_TIMEOUT
from
argparse
import
ArgumentDefaultsHelpFormatter
from
functools
import
lru_cache
from
threading
import
Thread
...
...
@@ -152,6 +153,7 @@ def main(args, conf, log_):
try
:
while
True
:
sock
,
addr
=
server
.
accept
()
sock
.
settimeout
(
SOCKET_TIMEOUT
)
log
.
info
(
'
accepting connection from
'
,
addr
,
'
as
'
,
sock
.
fileno
())
t
=
new_thread
(
args
,
conf
,
sock
)
t
.
start
()
...
...
This diff is collapsed.
Click to expand it.
sbws/globals.py
+
1
−
0
View file @
c7a7a7a3
...
...
@@ -19,6 +19,7 @@ G_INIT_FILE_MAP = [
# happens to require an sbws major version bump.
MIN_REQ_BYTES
=
1
MAX_REQ_BYTES
=
50
*
1024
*
1024
# 50 MiB, tentatively XXX github #11
SOCKET_TIMEOUT
=
60
# seconds
def
is_initted
(
d
):
...
...
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