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
Mike Perry
Tor
Commits
cbf73b2b
Commit
cbf73b2b
authored
Jul 04, 2004
by
Roger Dingledine
Browse files
touchups all over
put uptime in descriptor svn:r2011
parent
5284826a
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/or/config.c
View file @
cbf73b2b
...
...
@@ -259,8 +259,6 @@ static int config_assign(or_options_t *options, struct config_line_t *list) {
return
0
;
}
/* XXX are there any other specifiers we want to give so making
* a several-thousand-byte string is less painful? */
const
char
default_dirservers_string
[]
=
"router moria1 18.244.0.188 9001 9021 9031
\n
"
"platform Tor 0.0.6rc1 on Linux moria.mit.edu i686
\n
"
...
...
@@ -380,15 +378,16 @@ int config_assign_default_dirservers(void) {
/** Set <b>options</b> to a reasonable default.
*
* Call this function when they're using the default torrc but
* we can't find it. For now, we just hard-code what comes in the
* default torrc.
* Call this function when we can't find any torrc config file.
*/
static
int
config_assign_default
(
or_options_t
*
options
)
{
static
int
config_assign_default
s
(
or_options_t
*
options
)
{
/* set them up as a client only */
options
->
SocksPort
=
9050
;
config_free_lines
(
options
->
ExitPolicy
);
options
->
ExitPolicy
=
config_line_prepend
(
NULL
,
"ExitPolicy"
,
"reject *:*"
);
/* plus give them a dirservers file */
if
(
config_assign_default_dirservers
()
<
0
)
return
-
1
;
...
...
@@ -585,7 +584,7 @@ int getconfig(int argc, char **argv, or_options_t *options) {
if
(
!
cf
)
{
if
(
using_default_torrc
==
1
)
{
log
(
LOG_NOTICE
,
"Configuration file '%s' not present, using reasonable defaults."
,
fname
);
if
(
config_assign_default
(
options
)
<
0
)
if
(
config_assign_default
s
(
options
)
<
0
)
return
-
1
;
}
else
{
log
(
LOG_WARN
,
"Unable to open configuration file '%s'."
,
fname
);
...
...
@@ -631,13 +630,6 @@ int getconfig(int argc, char **argv, or_options_t *options) {
result
=
-
1
;
}
#if 0
if(options->ORPort && options->DataDirectory == NULL) {
log(LOG_WARN,"DataDirectory option required if ORPort is set, but not found.");
result = -1;
}
#endif
if
(
options
->
ORPort
)
{
if
(
options
->
Nickname
==
NULL
)
{
log_fn
(
LOG_WARN
,
"Nickname required if ORPort is set, but not found."
);
...
...
@@ -676,7 +668,7 @@ int getconfig(int argc, char **argv, or_options_t *options) {
result
=
-
1
;
}
if
(
options
->
DirPort
&&
options
->
RecommendedVersions
==
NULL
)
{
if
(
options
->
AuthoritativeDir
&&
options
->
RecommendedVersions
==
NULL
)
{
log
(
LOG_WARN
,
"Directory servers must configure RecommendedVersions."
);
result
=
-
1
;
}
...
...
src/or/connection.c
View file @
cbf73b2b
...
...
@@ -235,8 +235,9 @@ void connection_close_immediate(connection_t *conn)
return
;
}
if
(
conn
->
outbuf_flushlen
)
{
log_fn
(
LOG_INFO
,
"Closing connection (fd %d, type %s, state %d) with data on outbuf."
,
conn
->
s
,
CONN_TYPE_TO_STRING
(
conn
->
type
),
conn
->
state
);
log_fn
(
LOG_INFO
,
"fd %d, type %s, state %d, %d bytes on outbuf."
,
conn
->
s
,
CONN_TYPE_TO_STRING
(
conn
->
type
),
conn
->
state
,
conn
->
outbuf_flushlen
);
}
tor_close_socket
(
conn
->
s
);
conn
->
s
=
-
1
;
...
...
src/or/main.c
View file @
cbf73b2b
...
...
@@ -28,7 +28,7 @@ static int stats_prev_global_read_bucket;
/** How many bytes have we read since we started the process? */
static
uint64_t
stats_n_bytes_read
=
0
;
/** How many seconds have we been running? */
static
long
stats_n_seconds_
reading
=
0
;
long
stats_n_seconds_
uptime
=
0
;
/** Array of all open connections; each element corresponds to the element of
* poll_array in the same position. The first nfds elements are valid. */
...
...
@@ -536,7 +536,7 @@ static int prepare_for_poll(void) {
if
(
now
.
tv_sec
>
current_second
)
{
/* the second has rolled over. check more stuff. */
++
stats_n_seconds_
reading
;
++
stats_n_seconds_
uptime
;
assert_all_pending_dns_resolves_ok
();
run_scheduled_events
(
now
.
tv_sec
);
assert_all_pending_dns_resolves_ok
();
...
...
@@ -844,9 +844,9 @@ static void dumpstats(int severity) {
100
*
(((
double
)
stats_n_data_bytes_received
)
/
(
stats_n_data_cells_received
*
RELAY_PAYLOAD_SIZE
))
);
if
(
stats_n_seconds_
reading
)
if
(
stats_n_seconds_
uptime
)
log
(
severity
,
"Average bandwidth used: %d bytes/sec"
,
(
int
)
(
stats_n_bytes_read
/
stats_n_seconds_
reading
));
(
int
)
(
stats_n_bytes_read
/
stats_n_seconds_
uptime
));
rep_hist_dump_stats
(
now
,
severity
);
rend_service_dump_stats
(
severity
);
...
...
src/or/router.c
View file @
cbf73b2b
...
...
@@ -11,6 +11,7 @@
**/
extern
or_options_t
options
;
/* command-line and config-file options */
extern
long
stats_n_seconds_uptime
;
/** Exposed for test.c. */
void
get_platform_str
(
char
*
platform
,
int
len
);
...
...
@@ -474,7 +475,8 @@ int router_rebuild_descriptor(void) {
*/
void
get_platform_str
(
char
*
platform
,
int
len
)
{
snprintf
(
platform
,
len
-
1
,
"Tor %s on %s"
,
VERSION
,
get_uname
());
snprintf
(
platform
,
len
-
1
,
"Tor %s (up %ld sec) on %s"
,
VERSION
,
stats_n_seconds_uptime
,
get_uname
());
platform
[
len
-
1
]
=
'\0'
;
return
;
}
...
...
src/or/routerlist.c
View file @
cbf73b2b
...
...
@@ -124,7 +124,7 @@ void add_nickname_list_to_smartlist(smartlist_t *sl, const char *list) {
if
(
router
->
is_running
)
smartlist_add
(
sl
,
router
);
else
log_fn
(
LOG_
INFO
,
"Nickname list includes '%s' which is known but down."
,
nick
);
log_fn
(
LOG_
WARN
,
"Nickname list includes '%s' which is known but down."
,
nick
);
}
else
log_fn
(
has_fetched_directory
?
LOG_WARN
:
LOG_INFO
,
"Nickname list includes '%s' which isn't a known router."
,
nick
);
...
...
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