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
2974c837
Commit
2974c837
authored
11 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'public/bug9082'
parents
2613c98f
0748c06f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/or/channel.c
+25
-12
25 additions, 12 deletions
src/or/channel.c
src/or/channel.h
+4
-0
4 additions, 0 deletions
src/or/channel.h
src/or/circuitmux.c
+25
-0
25 additions, 0 deletions
src/or/circuitmux.c
src/or/circuitmux.h
+2
-0
2 additions, 0 deletions
src/or/circuitmux.h
with
56 additions
and
12 deletions
src/or/channel.c
+
25
−
12
View file @
2974c837
...
...
@@ -803,6 +803,7 @@ channel_free(channel_t *chan)
/* Get rid of cmux */
if
(
chan
->
cmux
)
{
circuitmux_detach_all_circuits
(
chan
->
cmux
);
circuitmux_mark_destroyed_circids_usable
(
chan
->
cmux
,
chan
);
circuitmux_free
(
chan
->
cmux
);
chan
->
cmux
=
NULL
;
}
...
...
@@ -2616,6 +2617,29 @@ channel_queue_var_cell(channel_t *chan, var_cell_t *var_cell)
}
}
/** If <b>packed_cell</b> on <b>chan</b> is a destroy cell, then set
* *<b>circid_out</b> to its circuit ID, and return true. Otherwise, return
* false. */
/* XXXX Move this function. */
int
packed_cell_is_destroy
(
channel_t
*
chan
,
const
packed_cell_t
*
packed_cell
,
circid_t
*
circid_out
)
{
if
(
chan
->
wide_circ_ids
)
{
if
(
packed_cell
->
body
[
4
]
==
CELL_DESTROY
)
{
*
circid_out
=
ntohl
(
get_uint32
(
packed_cell
->
body
));
return
1
;
}
}
else
{
if
(
packed_cell
->
body
[
2
]
==
CELL_DESTROY
)
{
*
circid_out
=
ntohs
(
get_uint16
(
packed_cell
->
body
));
return
1
;
}
}
return
0
;
}
/** DOCDOC */
static
int
is_destroy_cell
(
channel_t
*
chan
,
...
...
@@ -2636,18 +2660,7 @@ is_destroy_cell(channel_t *chan,
}
break
;
case
CELL_QUEUE_PACKED
:
if
(
chan
->
wide_circ_ids
)
{
if
(
q
->
u
.
packed
.
packed_cell
->
body
[
4
]
==
CELL_DESTROY
)
{
*
circid_out
=
ntohl
(
get_uint32
(
q
->
u
.
packed
.
packed_cell
->
body
));
return
1
;
}
}
else
{
if
(
q
->
u
.
packed
.
packed_cell
->
body
[
2
]
==
CELL_DESTROY
)
{
*
circid_out
=
ntohs
(
get_uint16
(
q
->
u
.
packed
.
packed_cell
->
body
));
return
1
;
}
}
break
;
return
packed_cell_is_destroy
(
chan
,
q
->
u
.
packed
.
packed_cell
,
circid_out
);
}
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
src/or/channel.h
+
4
−
0
View file @
2974c837
...
...
@@ -477,5 +477,9 @@ uint64_t channel_count_xmitted(channel_t *chan);
uint64_t
channel_listener_count_accepted
(
channel_listener_t
*
chan_l
);
int
packed_cell_is_destroy
(
channel_t
*
chan
,
const
packed_cell_t
*
packed_cell
,
circid_t
*
circid_out
);
#endif
This diff is collapsed.
Click to expand it.
src/or/circuitmux.c
+
25
−
0
View file @
2974c837
...
...
@@ -498,6 +498,31 @@ circuitmux_detach_all_circuits(circuitmux_t *cmux)
cmux
->
n_cells
=
0
;
}
/** Reclaim all circuit IDs currently marked as unusable on <b>chan</b> because
* of pending destroy cells in <b>cmux</b>.
*
* This function must be called AFTER circuits are unlinked from the (channel,
* circuid-id) map with circuit_unlink_all_from_channel(), but before calling
* circuitmux_free().
*/
void
circuitmux_mark_destroyed_circids_usable
(
circuitmux_t
*
cmux
,
channel_t
*
chan
)
{
packed_cell_t
*
cell
;
int
n_bad
=
0
;
for
(
cell
=
cmux
->
destroy_cell_queue
.
head
;
cell
;
cell
=
cell
->
next
)
{
circid_t
circid
=
0
;
if
(
packed_cell_is_destroy
(
chan
,
cell
,
&
circid
))
{
channel_mark_circid_usable
(
chan
,
circid
);
}
else
{
++
n_bad
;
}
}
if
(
n_bad
)
log_warn
(
LD_BUG
,
"%d cell(s) on destroy queue did not look like a "
"DESTROY cell."
,
n_bad
);
}
/**
* Free a circuitmux_t; the circuits must be detached first with
* circuitmux_detach_all_circuits().
...
...
This diff is collapsed.
Click to expand it.
src/or/circuitmux.h
+
2
−
0
View file @
2974c837
...
...
@@ -137,6 +137,8 @@ void circuitmux_set_num_cells(circuitmux_t *cmux, circuit_t *circ,
void
circuitmux_append_destroy_cell
(
channel_t
*
chan
,
circuitmux_t
*
cmux
,
circid_t
circ_id
,
uint8_t
reason
);
void
circuitmux_mark_destroyed_circids_usable
(
circuitmux_t
*
cmux
,
channel_t
*
chan
);
#endif
/* TOR_CIRCUITMUX_H */
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