diff options
author | Roger Dingledine <arma@torproject.org> | 2005-02-10 06:31:34 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2005-02-10 06:31:34 +0000 |
commit | 37ca621301134d567fbaa7cbbc84b3c10807726c (patch) | |
tree | e5282fe9011a0f2d4b62e83a541d468425256b93 /src/or/connection.c | |
parent | 1ebebff1a0a8d7808c6734cc7c84f61ceb08c837 (diff) | |
download | tor-37ca621301134d567fbaa7cbbc84b3c10807726c.tar.gz tor-37ca621301134d567fbaa7cbbc84b3c10807726c.zip |
when a client asks us for a dir mirror and we don't have one,
launch an attempt to get a fresh one.
svn:r3609
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index d410e9b895..6fd80c8745 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1256,6 +1256,23 @@ connection_t *connection_get_by_type_state(int type, int state) { return NULL; } +/** Return a connection of type <b>type</b> that has purpose <b>purpose</b>, + * and that is not marked for close. + */ +connection_t *connection_get_by_type_purpose(int type, int purpose) { + int i, n; + connection_t *conn; + connection_t **carray; + + get_connection_array(&carray,&n); + for (i=0;i<n;i++) { + conn = carray[i]; + if (conn->type == type && conn->purpose == purpose && !conn->marked_for_close) + return conn; + } + return NULL; +} + /** Return the connection of type <b>type</b> that is in state * <b>state</b>, that was written to least recently, and that is not * marked for close. |