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
c42c2b66
Commit
c42c2b66
authored
22 years ago
by
Roger Dingledine
Browse files
Options
Downloads
Patches
Plain Diff
only choose routers for the onion that are currently connected to us
svn:r72
parent
cd0760dd
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/onion.c
+10
-7
10 additions, 7 deletions
src/or/onion.c
with
10 additions
and
7 deletions
src/or/onion.c
+
10
−
7
View file @
c42c2b66
...
...
@@ -100,8 +100,8 @@ unsigned int *new_route(double cw, routerinfo_t **rarray, size_t rarray_len, siz
unsigned
int
*
route
=
NULL
;
unsigned
int
oldchoice
,
choice
;
if
(
(
cw
>=
0
)
&&
(
cw
<
1
)
&&
(
rarray
)
&&
(
rlen
)
)
/* valid parameters */
{
assert
(
(
cw
>=
0
)
&&
(
cw
<
1
)
&&
(
rarray
)
&&
(
rlen
)
)
;
/* valid parameters */
routelen
=
chooselen
(
cw
);
if
(
routelen
==
-
1
)
{
...
...
@@ -109,6 +109,9 @@ unsigned int *new_route(double cw, routerinfo_t **rarray, size_t rarray_len, siz
return
NULL
;
}
log
(
LOG_DEBUG
,
"new_route(): Chosen route length %u."
,
routelen
);
/* FIXME need to figure out how many routers we can actually choose from.
* We can get into an infinite loop if there are too few. */
/* allocate memory for the new route */
route
=
(
unsigned
int
*
)
malloc
(
routelen
*
sizeof
(
unsigned
int
));
...
...
@@ -132,8 +135,11 @@ unsigned int *new_route(double cw, routerinfo_t **rarray, size_t rarray_len, siz
choice
=
choice
%
(
rarray_len
);
log
(
LOG_DEBUG
,
"new_route() : Chosen router %u."
,
choice
);
if
(
choice
==
oldchoice
||
(
oldchoice
<
rarray_len
&&
!
pkey_cmp
(
rarray
[
choice
]
->
pkey
,
rarray
[
oldchoice
]
->
pkey
)))
{
/* same router, or router twin. try again. */
(
oldchoice
<
rarray_len
&&
!
pkey_cmp
(
rarray
[
choice
]
->
pkey
,
rarray
[
oldchoice
]
->
pkey
))
||
!
connection_twin_get_by_addr_port
(
rarray
[
choice
]
->
addr
,
rarray
[
choice
]
->
or_port
))
{
/* Same router as last choice, or router twin,
* or no routers with that key are connected to us.
* Try again. */
i
--
;
continue
;
}
...
...
@@ -143,9 +149,6 @@ unsigned int *new_route(double cw, routerinfo_t **rarray, size_t rarray_len, siz
*
rlen
=
routelen
;
return
route
;
}
/* valid parameters */
else
/* invalid parameters */
return
NULL
;
}
/* creates a new onion from route, stores it and its length into bufp and lenp respectively */
...
...
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