[or-cvs] AP conns use conn->rend_query now too

Roger Dingledine arma at seul.org
Fri Apr 2 23:54:50 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	circuit.c connection_edge.c or.h rendclient.c 
Log Message:
AP conns use conn->rend_query now too

expose connection_ap_handshake_attach_circuit()


Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.173
retrieving revision 1.174
diff -u -d -r1.173 -r1.174
--- circuit.c	2 Apr 2004 23:44:45 -0000	1.173
+++ circuit.c	2 Apr 2004 23:54:48 -0000	1.174
@@ -298,7 +298,7 @@
           continue;
         }
       } else { /* not general */
-        if(rend_cmp_service_ids(conn->socks_request->address, circ->rend_query)) {
+        if(rend_cmp_service_ids(conn->rend_query, circ->rend_query)) {
           /* this circ is not for this conn */
           continue;
         }
@@ -1070,7 +1070,7 @@
   /* we should examine circ and see if it failed because of
    * the last hop or an earlier hop. then use this info below.
    */
-  int failed_at_last_hop;
+  //int failed_at_last_hop;
 
   switch(circ->purpose) {
     case CIRCUIT_PURPOSE_C_GENERAL:

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -d -r1.128 -r1.129
--- connection_edge.c	2 Apr 2004 23:38:26 -0000	1.128
+++ connection_edge.c	2 Apr 2004 23:54:48 -0000	1.129
@@ -9,7 +9,6 @@
 extern char *conn_state_to_string[][_CONN_TYPE_MAX+1];
 
 static int connection_ap_handshake_process_socks(connection_t *conn);
-static int connection_ap_handshake_attach_circuit(connection_t *conn);
 static void connection_ap_handshake_send_begin(connection_t *ap_conn, circuit_t *circ);
 
 static int connection_exit_begin_conn(cell_t *cell, circuit_t *circ);
@@ -745,8 +744,9 @@
     const char *descp;
     int desc_len;
 
+    strcpy(conn->rend_query, socks->address);
     /* see if we already have it cached */
-    if (rend_cache_lookup(socks->address, &descp, &desc_len) == 1) {
+    if (rend_cache_lookup(conn->rend_query, &descp, &desc_len) == 1) {
       conn->purpose = AP_PURPOSE_RENDPOINT_WAIT;
       return connection_ap_handshake_attach_circuit(conn);
       //circuit_launch_new(CIRCUIT_PURPOSE_C_ESTABLISH_REND, NULL);
@@ -755,7 +755,7 @@
       /* initiate a dir hidserv desc lookup */
       directory_initiate_command(router_pick_directory_server(),
                                  DIR_PURPOSE_FETCH_RENDDESC,
-                                 socks->address, strlen(socks->address));
+                                 conn->rend_query, strlen(conn->rend_query));
       return 0;
     }
   }
@@ -769,7 +769,7 @@
  * Otherwise, associate conn with a safe live circuit, do the
  * right next step, and return 1.
  */
-static int connection_ap_handshake_attach_circuit(connection_t *conn) {
+int connection_ap_handshake_attach_circuit(connection_t *conn) {
   circuit_t *circ;
   uint32_t addr;
   uint8_t desired_circuit_purpose;
@@ -820,8 +820,7 @@
       if (desired_circuit_purpose == CIRCUIT_PURPOSE_C_GENERAL ||
           desired_circuit_purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND) {
         /* then write the service_id into circ */
-        strncpy(circ->rend_query, conn->socks_request->address,
-                CRYPTO_SHA1_DIGEST_LEN); /* pad with nuls */
+        strcpy(circ->rend_query, conn->rend_query);
       }
     }
     return 0;

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.285
retrieving revision 1.286
diff -u -d -r1.285 -r1.286
--- or.h	2 Apr 2004 23:44:45 -0000	1.285
+++ or.h	2 Apr 2004 23:54:48 -0000	1.286
@@ -404,7 +404,7 @@
                         * add 'bandwidth' to this, capping it at 10*bandwidth.
                         */
 
-/* Used only by dir connections: */
+/* Used only by DIR and AP connections: */
   char rend_query[REND_SERVICE_ID_LEN+1];
 
 /* Used only by edge connections: */
@@ -845,6 +845,8 @@
 
 int connection_edge_package_raw_inbuf(connection_t *conn);
 
+int connection_ap_handshake_attach_circuit(connection_t *conn);
+
 int connection_ap_make_bridge(char *address, uint16_t port);
 
 void connection_ap_handshake_socks_reply(connection_t *conn, char *reply,
@@ -978,6 +980,7 @@
 /********************************* routerlist.c ***************************/
 
 routerinfo_t *router_pick_directory_server(void);
+struct smartlist_t;
 routerinfo_t *router_choose_random_node(routerlist_t *dir,
                                         char *preferred, char *excluded,
                                         struct smartlist_t *excludedsmartlist);

Index: rendclient.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendclient.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- rendclient.c	2 Apr 2004 23:38:26 -0000	1.2
+++ rendclient.c	2 Apr 2004 23:54:48 -0000	1.3
@@ -49,7 +49,7 @@
       continue;
     if (conn->purpose != AP_PURPOSE_RENDDESC_WAIT)
       continue;
-    if (rend_cmp_service_ids(conn->socks_request->address, query))
+    if (rend_cmp_service_ids(conn->rend_query, query))
       continue;
     /* great, this guy was waiting */
     if(success) {



More information about the tor-commits mailing list