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
b9480620
Commit
b9480620
authored
21 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Patches
Plain Diff
Make log_fn work on apples with no workarounds needed in main code
svn:r330
parent
df2789c1
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
doc/tor-spec.txt
+6
-0
6 additions, 0 deletions
doc/tor-spec.txt
src/common/log.h
+7
-4
7 additions, 4 deletions
src/common/log.h
src/or/routers.c
+7
-7
7 additions, 7 deletions
src/or/routers.c
with
20 additions
and
11 deletions
doc/tor-spec.txt
+
6
−
0
View file @
b9480620
...
...
@@ -487,6 +487,12 @@ which reveals the downstream node.
cells, echo their contents to the corresponding TCP stream.
[XXX Mention zlib encoding. -NM]
5.2. Closing connections
[Note -- TCP streams can only be half-closed for reading. Our
Bickford's conversation was incorrect. -NM]
When one side of the TCP stream is closed, the corresponding edge
node sends a RELAY_END cell along the circuit; upon receiving a
RELAY_END cell, the edge node closes its side of the corresponding
...
...
This diff is collapsed.
Click to expand it.
src/common/log.h
+
7
−
4
View file @
b9480620
...
...
@@ -13,10 +13,13 @@
void
log
(
int
severity
,
const
char
*
format
,
...);
#ifdef __GNUC__
#define log_fn(severity, format) \
log((severity), "%s(): " format , __PRETTY_FUNCTION__)
#define log_fnf(severity, format, args...) \
log((severity), "%s(): " format , __PRETTY_FUNCTION__ , ##args)
#ifdef __APPLE_CPP__
#define log_fn(severity, args...) \
log((severity), __PRETTY_FUNCTION__ "(): " args)
#else
#define log_fn(severity, format, args...) \
log((severity), "%s(): " format, __PRETTY_FUNCTION__ , ##args)
#endif
#else
#define log_fn log
#define log_fnf log
...
...
This diff is collapsed.
Click to expand it.
src/or/routers.c
+
7
−
7
View file @
b9480620
...
...
@@ -47,7 +47,7 @@ int learn_my_address(struct sockaddr_in *me) {
log_fn
(
LOG_ERR
,
"Error obtaining local hostname"
);
return
-
1
;
}
log_fn
f
(
LOG_DEBUG
,
"localhostname is '%s'."
,
localhostname
);
log_fn
(
LOG_DEBUG
,
"localhostname is '%s'."
,
localhostname
);
localhost
=
gethostbyname
(
localhostname
);
if
(
!
localhost
)
{
log_fn
(
LOG_ERR
,
"Error obtaining local host info."
);
...
...
@@ -57,7 +57,7 @@ int learn_my_address(struct sockaddr_in *me) {
me
->
sin_family
=
AF_INET
;
memcpy
((
void
*
)
&
me
->
sin_addr
,(
void
*
)
localhost
->
h_addr
,
sizeof
(
struct
in_addr
));
me
->
sin_port
=
htons
(
options
.
ORPort
);
log_fn
f
(
LOG_DEBUG
,
"chose address as '%s'."
,
inet_ntoa
(
me
->
sin_addr
));
log_fn
(
LOG_DEBUG
,
"chose address as '%s'."
,
inet_ntoa
(
me
->
sin_addr
));
return
0
;
}
...
...
@@ -69,7 +69,7 @@ void router_retry_connections(void) {
for
(
i
=
0
;
i
<
directory
->
n_routers
;
i
++
)
{
router
=
directory
->
routers
[
i
];
if
(
!
connection_exact_get_by_addr_port
(
router
->
addr
,
router
->
or_port
))
{
/* not in the list */
log_fn
f
(
LOG_DEBUG
,
"connecting to OR %s:%u."
,
router
->
address
,
router
->
or_port
);
log_fn
(
LOG_DEBUG
,
"connecting to OR %s:%u."
,
router
->
address
,
router
->
or_port
);
connection_or_connect
(
router
);
}
}
...
...
@@ -199,26 +199,26 @@ int router_get_list_from_file(char *routerfile)
assert
(
routerfile
);
if
(
strcspn
(
routerfile
,
CONFIG_LEGAL_FILENAME_CHARACTERS
)
!=
0
)
{
log_fn
f
(
LOG_ERR
,
"Filename %s contains illegal characters."
,
routerfile
);
log_fn
(
LOG_ERR
,
"Filename %s contains illegal characters."
,
routerfile
);
return
-
1
;
}
if
(
stat
(
routerfile
,
&
statbuf
)
<
0
)
{
log_fn
f
(
LOG_ERR
,
"Could not stat %s."
,
routerfile
);
log_fn
(
LOG_ERR
,
"Could not stat %s."
,
routerfile
);
return
-
1
;
}
/* open the router list */
fd
=
open
(
routerfile
,
O_RDONLY
,
0
);
if
(
fd
<
0
)
{
log_fn
f
(
LOG_ERR
,
"Could not open %s."
,
routerfile
);
log_fn
(
LOG_ERR
,
"Could not open %s."
,
routerfile
);
return
-
1
;
}
string
=
tor_malloc
(
statbuf
.
st_size
+
1
);
if
(
read
(
fd
,
string
,
statbuf
.
st_size
)
!=
statbuf
.
st_size
)
{
log_fn
f
(
LOG_ERR
,
"Couldn't read all %d bytes of file '%s'."
,
statbuf
.
st_size
,
routerfile
);
log_fn
(
LOG_ERR
,
"Couldn't read all %d bytes of file '%s'."
,
statbuf
.
st_size
,
routerfile
);
free
(
string
);
close
(
fd
);
return
-
1
;
...
...
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