Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Mike Perry
Tor
Commits
c03e9206
Commit
c03e9206
authored
21 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Patches
Plain Diff
Clean up dns->connection_mark_for_close->dns_remove path
svn:r1230
parent
9944ad6b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/or/dns.c
+15
-17
15 additions, 17 deletions
src/or/dns.c
with
15 additions
and
17 deletions
src/or/dns.c
+
15
−
17
View file @
c03e9206
...
...
@@ -86,7 +86,7 @@ static void purge_expired_resolves(uint32_t now) {
if
(
!
oldest_cached_resolve
)
/* if there are no more, */
newest_cached_resolve
=
NULL
;
/* then make sure the list's tail knows that too */
SPLAY_REMOVE
(
cache_tree
,
&
cache_root
,
resolve
);
free
(
resolve
);
tor_
free
(
resolve
);
}
}
...
...
@@ -146,7 +146,7 @@ int dns_resolve(connection_t *exitconn) {
/* add us to the pending list */
pending_connection
=
tor_malloc
(
sizeof
(
struct
pending_connection_t
));
pending_connection
->
conn
=
exitconn
;
pending_connection
->
next
=
resolve
->
pending_connections
;
pending_connection
->
next
=
NULL
;
resolve
->
pending_connections
=
pending_connection
;
/* add us to the linked list of resolves */
...
...
@@ -178,7 +178,7 @@ static int assign_to_dnsworker(connection_t *exitconn) {
log_fn
(
LOG_DEBUG
,
"Connection (fd %d) needs to resolve '%s'; assigning to DNSWorker (fd %d)"
,
exitconn
->
s
,
exitconn
->
address
,
dnsconn
->
s
);
free
(
dnsconn
->
address
);
tor_
free
(
dnsconn
->
address
);
dnsconn
->
address
=
tor_strdup
(
exitconn
->
address
);
dnsconn
->
state
=
DNSWORKER_STATE_BUSY
;
num_dnsworkers_busy
++
;
...
...
@@ -213,7 +213,7 @@ void connection_dns_remove(connection_t *conn)
if
(
pend
->
conn
==
conn
)
{
resolve
->
pending_connections
=
pend
->
next
;
free
(
pend
);
tor_
free
(
pend
);
log_fn
(
LOG_DEBUG
,
"Connection (fd %d) no longer waiting for resolve of '%s'"
,
conn
->
s
,
conn
->
address
);
return
;
...
...
@@ -222,7 +222,7 @@ void connection_dns_remove(connection_t *conn)
if
(
pend
->
next
->
conn
==
conn
)
{
victim
=
pend
->
next
;
pend
->
next
=
victim
->
next
;
free
(
victim
);
tor_
free
(
victim
);
log_fn
(
LOG_DEBUG
,
"Connection (fd %d) no longer waiting for resolve of '%s'"
,
conn
->
s
,
conn
->
address
);
return
;
/* more are pending */
...
...
@@ -256,11 +256,11 @@ void dns_cancel_pending_resolve(char *address) {
address
);
while
(
resolve
->
pending_connections
)
{
pend
=
resolve
->
pending_connections
;
/* This calls dns_cancel_pending_resolve, which removes pend
* from the list, so we don't have to do it. Beware of
* modify-while-iterating bugs hereabouts! */
/* So that mark_for_close doesn't double-remove the connection. */
pend
->
conn
->
state
=
EXIT_CONN_STATE_RESOLVEFAILED
;
connection_mark_for_close
(
pend
->
conn
,
END_STREAM_REASON_MISC
);
assert
(
resolve
->
pending_connections
!=
pend
);
resolve
->
pending_connections
=
pend
->
next
;
tor_free
(
pend
);
}
/* remove resolve from the linked list */
...
...
@@ -281,7 +281,7 @@ void dns_cancel_pending_resolve(char *address) {
/* remove resolve from the tree */
SPLAY_REMOVE
(
cache_tree
,
&
cache_root
,
resolve
);
free
(
resolve
);
tor_
free
(
resolve
);
}
static
void
dns_found_answer
(
char
*
address
,
uint32_t
addr
)
{
...
...
@@ -322,16 +322,14 @@ static void dns_found_answer(char *address, uint32_t addr) {
assert_connection_ok
(
pend
->
conn
,
time
(
NULL
));
pend
->
conn
->
addr
=
resolve
->
addr
;
if
(
resolve
->
state
==
CACHE_STATE_FAILED
)
{
/* This calls dns_cancel_pending_resolve, which removes pend
* from the list, so we don't have to do it. Beware of
* modify-while-iterating bugs hereabouts! */
/* prevent double-remove */
pend
->
conn
->
state
=
EXIT_CONN_STATE_RESOLVEFAILED
;
connection_mark_for_close
(
pend
->
conn
,
END_STREAM_REASON_RESOLVEFAILED
);
assert
(
resolve
->
pending_connections
!=
pend
);
}
else
{
connection_exit_connect
(
pend
->
conn
);
resolve
->
pending_connections
=
pend
->
next
;
free
(
pend
);
}
resolve
->
pending_connections
=
pend
->
next
;
tor_free
(
pend
);
}
}
...
...
@@ -371,7 +369,7 @@ int connection_dns_process_inbuf(connection_t *conn) {
dns_found_answer
(
conn
->
address
,
addr
);
free
(
conn
->
address
);
tor_
free
(
conn
->
address
);
conn
->
address
=
tor_strdup
(
"<idle>"
);
conn
->
state
=
DNSWORKER_STATE_IDLE
;
num_dnsworkers_busy
--
;
...
...
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