Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
sbws
Commits
4e73693a
Commit
4e73693a
authored
Jul 18, 2018
by
juga
Committed by
Matt Traudt
Aug 03, 2018
Browse files
Remove is_initted and add config paths
parent
88e1f05c
Changes
1
Hide whitespace changes
Inline
Side-by-side
sbws/globals.py
View file @
4e73693a
...
...
@@ -8,10 +8,6 @@ RESULT_VERSION = 4
WIRE_VERSION
=
1
SPEC_VERSION
=
'1.1.0'
PKG_DIR
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
SOCKET_TIMEOUT
=
60
# seconds
# This is a dictionary of torrc options we always want to set when launching
# Tor and that do not depend on any runtime configuration
TORRC_STARTING_POINT
=
{
...
...
@@ -27,23 +23,17 @@ TORRC_STARTING_POINT = {
'UseMicrodescriptors'
:
'0'
,
}
PKG_DIR
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
DEFAULT_CONFIG_PATH
=
os
.
path
.
join
(
PKG_DIR
,
'config.default.ini'
)
DEFAULT_LOG_CONFIG_PATH
=
os
.
path
.
join
(
PKG_DIR
,
'config.log.default.ini'
)
MINIMUM_USER_CONFIG_PATH
=
os
.
path
.
join
(
PKG_DIR
,
'config.user.ini'
)
USER_CONFIG_PATH
=
os
.
path
.
join
(
os
.
path
.
expanduser
(
'~'
),
'.sbws.ini'
)
SOCKET_TIMEOUT
=
60
# seconds
SCALE_CONSTANT
=
7500
BW_LINE_SIZE
=
510
def
is_initted
(
d
):
if
not
os
.
path
.
isdir
(
d
):
log
.
debug
(
'%s not initialized: %s doesn
\'
t exist'
,
d
,
d
)
return
False
conf_fnames
=
[
os
.
path
.
join
(
d
,
'config.ini'
)]
for
fname
in
conf_fnames
:
if
not
os
.
path
.
isfile
(
fname
):
log
.
debug
(
'%s not initialized: missing %s'
,
d
,
fname
)
return
False
log
.
debug
(
'%s seems initialized.'
,
d
)
return
True
def
fail_hard
(
*
a
,
**
kw
):
''' Log something ... and then exit as fast as possible '''
log
.
critical
(
*
a
,
**
kw
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment