diff options
author | Roger Dingledine <arma@torproject.org> | 2004-03-26 22:07:45 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-03-26 22:07:45 +0000 |
commit | 9c69f14a49cdeac2ebe3179ec1095dbe913d7c74 (patch) | |
tree | 6cb2790f7aad69b01f9e777d566b20ccd5d20b62 | |
parent | 3be56afa052fb30ad74a75347063c2b066d50973 (diff) | |
download | tor-9c69f14a49cdeac2ebe3179ec1095dbe913d7c74.tar.gz tor-9c69f14a49cdeac2ebe3179ec1095dbe913d7c74.zip |
fix two assert triggers (darn it, I hate releasing software)
when connecting to a dirserver or OR and the network is down,
we would crash.
svn:r1340
-rw-r--r-- | src/or/connection_or.c | 2 | ||||
-rw-r--r-- | src/or/directory.c | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 5fb4ac183d..833965250c 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -111,6 +111,7 @@ connection_t *connection_or_connect(routerinfo_t *router) { /* set up conn so it's got all the data we need to remember */ connection_or_init_conn_from_router(conn, router); + conn->state = OR_CONN_STATE_CONNECTING; if(connection_add(conn) < 0) { /* no space, forget it */ connection_free(conn); @@ -126,7 +127,6 @@ connection_t *connection_or_connect(routerinfo_t *router) { connection_watch_events(conn, POLLIN | POLLOUT | POLLERR); /* writable indicates finish, readable indicates broken link, error indicates broken link on windows */ - conn->state = OR_CONN_STATE_CONNECTING; return conn; /* case 1: fall through */ } diff --git a/src/or/directory.c b/src/or/directory.c index 4506cf945a..9c2d794338 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -40,6 +40,8 @@ void directory_initiate_command(routerinfo_t *router, int command) { assert(router->identity_pkey); conn->identity_pkey = crypto_pk_dup_key(router->identity_pkey); + conn->state = command; + if(connection_add(conn) < 0) { /* no space, forget it */ connection_free(conn); return; @@ -55,7 +57,6 @@ void directory_initiate_command(routerinfo_t *router, int command) { connection_watch_events(conn, POLLIN | POLLOUT | POLLERR); /* writable indicates finish, readable indicates broken link, error indicates broken link in windowsland. */ - conn->state = command; return; /* case 1: fall through */ } @@ -76,7 +77,6 @@ static int directory_send_command(connection_t *conn, int command) { switch(command) { case DIR_CONN_STATE_CONNECTING_FETCH: connection_write_to_buf(fetchstring, strlen(fetchstring), conn); - conn->state = DIR_CONN_STATE_CLIENT_SENDING_FETCH; break; case DIR_CONN_STATE_CONNECTING_UPLOAD: s = router_get_my_descriptor(); @@ -87,7 +87,6 @@ static int directory_send_command(connection_t *conn, int command) { snprintf(tmp, sizeof(tmp), "POST / HTTP/1.0\r\nContent-Length: %d\r\n\r\n%s", (int)strlen(s), s); connection_write_to_buf(tmp, strlen(tmp), conn); - conn->state = DIR_CONN_STATE_CLIENT_SENDING_UPLOAD; break; } return 0; |