/* 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);
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 */
}
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;
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 */
}
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();
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;