mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-13 06:33:44 +01:00
clean up some more.
i think i'm getting closer. svn:r2931
This commit is contained in:
parent
310a8da0d2
commit
27b8797245
@ -159,9 +159,9 @@ void buf_free(buf_t *buf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Read from socket <b>s</b>, writing onto end of <b>buf</b>. Read at most
|
/** Read from socket <b>s</b>, writing onto end of <b>buf</b>. Read at most
|
||||||
* <b>at_most</b> bytes, resizing the buffer as necessary. If read()
|
* <b>at_most</b> bytes, resizing the buffer as necessary. If recv()
|
||||||
* returns 0, set <b>*reached_eof</b> to 1 and return 0. Return -1 on error;
|
* returns 0, set <b>*reached_eof</b> to 1 and return 0. Return -1 on error;
|
||||||
* else return the number of bytes read. Return 0 if read() would
|
* else return the number of bytes read. Return 0 if recv() would
|
||||||
* block.
|
* block.
|
||||||
*/
|
*/
|
||||||
int read_to_buf(int s, size_t at_most, buf_t *buf, int *reached_eof) {
|
int read_to_buf(int s, size_t at_most, buf_t *buf, int *reached_eof) {
|
||||||
|
@ -1009,7 +1009,7 @@ circuit_resume_edge_reading_helper(connection_t *conn,
|
|||||||
/** Check if the package window for <b>circ</b> is empty (at
|
/** Check if the package window for <b>circ</b> is empty (at
|
||||||
* hop <b>layer_hint</b> if it's defined).
|
* hop <b>layer_hint</b> if it's defined).
|
||||||
*
|
*
|
||||||
* If yes, tell edge streams to stop reading and return -1.
|
* If yes, tell edge streams to stop reading and return 1.
|
||||||
* Else return 0.
|
* Else return 0.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
@ -1017,13 +1017,19 @@ circuit_consider_stop_edge_reading(circuit_t *circ, crypt_path_t *layer_hint)
|
|||||||
{
|
{
|
||||||
connection_t *conn = NULL;
|
connection_t *conn = NULL;
|
||||||
|
|
||||||
log_fn(LOG_DEBUG,"considering");
|
if (!layer_hint) {
|
||||||
if(!layer_hint && circ->package_window <= 0) {
|
log_fn(LOG_DEBUG,"considering circ->package_window %d", circ->package_window);
|
||||||
log_fn(LOG_DEBUG,"yes, not-at-origin. stopped.");
|
if (circ->package_window <= 0) {
|
||||||
for(conn = circ->n_streams; conn; conn=conn->next_stream)
|
log_fn(LOG_DEBUG,"yes, not-at-origin. stopped.");
|
||||||
connection_stop_reading(conn);
|
for(conn = circ->n_streams; conn; conn=conn->next_stream)
|
||||||
return -1;
|
connection_stop_reading(conn);
|
||||||
} else if(layer_hint && layer_hint->package_window <= 0) {
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/* else, layer hint is defined, use it */
|
||||||
|
log_fn(LOG_DEBUG,"considering layer_hint->package_window %d", layer_hint->package_window);
|
||||||
|
if (layer_hint->package_window <= 0) {
|
||||||
log_fn(LOG_DEBUG,"yes, at-origin. stopped.");
|
log_fn(LOG_DEBUG,"yes, at-origin. stopped.");
|
||||||
for(conn = circ->n_streams; conn; conn=conn->next_stream)
|
for(conn = circ->n_streams; conn; conn=conn->next_stream)
|
||||||
if(conn->cpath_layer == layer_hint)
|
if(conn->cpath_layer == layer_hint)
|
||||||
@ -1031,7 +1037,7 @@ circuit_consider_stop_edge_reading(circuit_t *circ, crypt_path_t *layer_hint)
|
|||||||
for(conn = circ->p_streams; conn; conn=conn->next_stream)
|
for(conn = circ->p_streams; conn; conn=conn->next_stream)
|
||||||
if(conn->cpath_layer == layer_hint)
|
if(conn->cpath_layer == layer_hint)
|
||||||
connection_stop_reading(conn);
|
connection_stop_reading(conn);
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user