]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
fix some bugs; more remain
authorRoger Dingledine <arma@torproject.org>
Sat, 3 Apr 2004 00:55:53 +0000 (00:55 +0000)
committerRoger Dingledine <arma@torproject.org>
Sat, 3 Apr 2004 00:55:53 +0000 (00:55 +0000)
svn:r1450

src/or/circuit.c
src/or/connection.c
src/or/connection_edge.c
src/or/or.h
src/or/rendclient.c

index cd87d59c7ac4d5c43a327005278625400e979195..81944fd03b54f7fcebf64e475f339a6af8629e82 100644 (file)
@@ -334,7 +334,7 @@ circuit_t *circuit_get_newest(connection_t *conn,
  * the list.
  */
 circuit_t *circuit_get_next_by_pk_and_purpose(circuit_t *start,
-                                         const char *digest, int purpose)
+                                         const char *digest, uint8_t purpose)
 {
   circuit_t *circ;
   if (start == NULL)
index b6ed726c3e6bc69d1ad0ae80b5dde8fb249e8f6a..3f0e5cbb5c3418a2c74d12505745228af368f92b 100644 (file)
@@ -1026,8 +1026,9 @@ void assert_connection_ok(connection_t *conn, time_t now)
   } else {
     assert(!conn->socks_request);
   }
-  if(conn->type != CONN_TYPE_DIR) {
-    assert(!conn->purpose); /* only used for dir types currently */
+  if(conn->type != CONN_TYPE_DIR &&
+     conn->type != CONN_TYPE_AP) {
+    assert(!conn->purpose); /* only used for dir and ap types currently */
   }
 
   switch(conn->type)
index a253b77bd7a8c050219d7b7ceb7274380dde8fc2..135ed98df6e06384967a8056ad8f6d9775f063a5 100644 (file)
@@ -817,8 +817,9 @@ int connection_ap_handshake_attach_circuit(connection_t *conn) {
       /* is one already on the way? */
       circ = circuit_launch_new(desired_circuit_purpose, NULL);
       /* depending on purpose, store stuff into circ */
-      if (desired_circuit_purpose == CIRCUIT_PURPOSE_C_GENERAL ||
-          desired_circuit_purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND) {
+      if(circ &&
+         (desired_circuit_purpose == CIRCUIT_PURPOSE_C_GENERAL ||
+          desired_circuit_purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND)) {
         /* then write the service_id into circ */
         strcpy(circ->rend_query, conn->rend_query);
       }
@@ -964,6 +965,7 @@ int connection_ap_make_bridge(char *address, uint16_t port) {
   }
 
   conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
+  conn->purpose = AP_PURPOSE_GENERAL;
   connection_start_reading(conn);
 
   /* attaching to a dirty circuit is fine */
index 43ca18bae6485284dffcf611b2d59ae66c0d9318..bfff91be5b6bba3785f56bd30a527e5300a84ac1 100644 (file)
 #define AP_PURPOSE_RENDDESC_WAIT 2
 #define AP_PURPOSE_RENDPOINT_WAIT 3
 #define AP_PURPOSE_INTROPOINT_WAIT 4
-#define _AP_PURPOSE_MAX 3
+#define _AP_PURPOSE_MAX 4
 
 #define _DIR_CONN_STATE_MIN 1
 #define DIR_CONN_STATE_CONNECTING 1
@@ -699,7 +699,7 @@ circuit_t *circuit_get_by_conn(connection_t *conn);
 circuit_t *circuit_get_newest(connection_t *conn,
                               int must_be_open, uint8_t conn_purpose);
 circuit_t *circuit_get_next_by_pk_and_purpose(circuit_t *circuit,
-                                             const char *servid, int purpose);
+                                              const char *servid, uint8_t purpose);
 circuit_t *circuit_get_rendezvous(const char *cookie);
 
 void circuit_expire_building(void);
index 8f8aa2679557b046dbf0e368ab6bf113cdf00277..bd775b4f6a236aacf34c4576c603aa6e25d52f0d 100644 (file)
@@ -9,7 +9,7 @@ void
 rend_client_introcirc_is_ready(connection_t *apconn, circuit_t *circ)
 {
 
-
+  log_fn(LOG_WARN,"introcirc is ready");
 }
 
 /* send the rendezvous cell */
@@ -18,6 +18,7 @@ rend_client_rendcirc_is_ready(connection_t *apconn, circuit_t *circ)
 {
 
 
+  log_fn(LOG_WARN,"rendcirc is ready");
 }
 
 /* bob sent us a rendezvous cell, join the circs. */