[flagday] Make connections finally work again. Circs claim to get built, too.

svn:r1659
This commit is contained in:
Nick Mathewson
2004-04-17 18:48:02 +00:00
parent 0393db76e0
commit 26eecb3243
2 changed files with 16 additions and 11 deletions
@@ -254,7 +254,7 @@ tor_tls_context_new(crypto_pk_env_t *identity,
if (crypto_pk_generate_key(rsa)<0)
goto error;
cert = tor_tls_create_certificate(rsa, identity, nickname, nn2);
idcert = tor_tls_create_certificate(rsa, identity, nn2, nn2);
idcert = tor_tls_create_certificate(identity, identity, nn2, nn2);
if (!cert || !idcert) {
log(LOG_WARN, "Error creating certificate");
goto error;
@@ -552,6 +552,7 @@ tor_tls_verify(tor_tls *tls, crypto_pk_env_t *identity_key)
EVP_PKEY *id_pkey = NULL;
time_t now, t;
int r = -1;
if (!(cert = SSL_get_peer_certificate(tls->ssl)))
return -1;
@@ -213,17 +213,21 @@ static int connection_tls_finish_handshake(connection_t *conn) {
}
log_fn(LOG_DEBUG,"The router's cert is valid.");
if((c=connection_exact_get_by_addr_port(router->addr,router->or_port))) {
log_fn(LOG_INFO,"Router %s is already connected on fd %d. Dropping fd %d.", router->nickname, c->s, conn->s);
return -1;
if (conn->nickname) {
/* I initiated this connection. */
if (strcmp(conn->nickname, nickname)) {
log_fn(options.DirPort ? LOG_WARN : LOG_INFO,
"Other side is '%s', but we tried to connect to '%s'",
nickname, conn->nickname);
return -1;
}
} else {
if((c=connection_exact_get_by_addr_port(router->addr,router->or_port))) {
log_fn(LOG_INFO,"Router %s is already connected on fd %d. Dropping fd %d.", router->nickname, c->s, conn->s);
return -1;
}
connection_or_init_conn_from_router(conn,router);
}
if (conn->nickname && strcmp(conn->nickname, nickname)) {
log_fn(options.DirPort ? LOG_WARN : LOG_INFO,
"Other side is '%s', but we tried to connect to '%s'",
nickname, conn->nickname);
return -1;
}
connection_or_init_conn_from_router(conn,router);
if (!options.ORPort) { /* If I'm an OP... */
conn->receiver_bucket = conn->bandwidth = DEFAULT_BANDWIDTH_OP;