[or-cvs] when the hidden service launches a rendezvous circ, make su...

Roger Dingledine arma at seul.org
Fri Jan 14 04:35:55 UTC 2005


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

Modified Files:
	rendservice.c 
Log Message:
when the hidden service launches a rendezvous circ, make sure it
provides good uptime if any virtual_port of the service wants that.


Index: rendservice.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/rendservice.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- rendservice.c	13 Jan 2005 20:21:11 -0000	1.113
+++ rendservice.c	14 Jan 2005 04:35:53 -0000	1.114
@@ -342,6 +342,22 @@
   return NULL;
 }
 
+/** Return 1 if any virtual port in <b>service</b> wants a circuit
+ * to have good uptime. Else return 0.
+ */
+static int
+rend_service_requires_uptime(rend_service_t *service) {
+  int i;
+  rend_service_port_config_t *p;
+
+  for (i=0; i < smartlist_len(service->ports); ++i) {
+    p = smartlist_get(service->ports, i);
+    if (smartlist_string_num_isin(get_options()->LongLivedPorts, p->virtual_port))
+      return 1;
+  }
+  return 0;
+}
+
 /******
  * Handle cells
  ******/
@@ -458,7 +474,8 @@
   /* Launch a circuit to alice's chosen rendezvous point.
    */
   for (i=0;i<MAX_REND_FAILURES;i++) {
-    launched = circuit_launch_by_nickname(CIRCUIT_PURPOSE_S_CONNECT_REND, rp_nickname, 0, 1);
+    launched = circuit_launch_by_nickname(CIRCUIT_PURPOSE_S_CONNECT_REND, rp_nickname,
+                                           rend_service_requires_uptime(service), 1);
     if (launched)
       break;
   }
@@ -806,7 +823,7 @@
   exclude_routers = smartlist_create();
   now = time(NULL);
 
-  for (i=0; i< smartlist_len(rend_service_list); ++i) {
+  for (i=0; i < smartlist_len(rend_service_list); ++i) {
     smartlist_clear(intro_routers);
     service = smartlist_get(rend_service_list, i);
 
@@ -824,7 +841,7 @@
     }
 
     /* Find out which introduction points we have in progress for this service. */
-    for (j=0;j< smartlist_len(service->intro_nodes); ++j) {
+    for (j=0; j < smartlist_len(service->intro_nodes); ++j) {
       intro = smartlist_get(service->intro_nodes, j);
       router = router_get_by_nickname(intro);
       if (!router || !find_intro_circuit(router,service->pk_digest)) {
@@ -906,7 +923,7 @@
   rend_service_t *service;
   int rendpostperiod = get_options()->RendPostPeriod;
 
-  for (i=0; i< smartlist_len(rend_service_list); ++i) {
+  for (i=0; i < smartlist_len(rend_service_list); ++i) {
     service = smartlist_get(rend_service_list, i);
     if (!service->next_upload_time) { /* never been uploaded yet */
       service->next_upload_time =



More information about the tor-commits mailing list