소스 검색

fix problems noticed by arma in rendservice.c

svn:r4558
Nick Mathewson 20 년 전
부모
커밋
331942870e
1개의 변경된 파일6개의 추가작업 그리고 8개의 파일을 삭제
  1. 6 8
      src/or/rendservice.c

+ 6 - 8
src/or/rendservice.c

@@ -592,8 +592,8 @@ rend_service_relaunch_rendezvous(circuit_t *oldcirc)
       oldcirc->build_state->failure_count > MAX_REND_FAILURES ||
       oldcirc->build_state->expiry_time < time(NULL)) {
     log_fn(LOG_INFO,"Attempt to build circuit to %s for rendezvous has failed too many times or expired; giving up.",
-           oldcirc->build_state->chosen_exit->nickname);
-    /* XXX bug: if the first clause of the if triggers, we'll seg fault. */
+           oldcirc->build_state ? oldcirc->build_state->chosen_exit->nickname :
+           "*unknown*");
     return;
   }
 
@@ -831,9 +831,8 @@ find_intro_circuit(routerinfo_t *router, const char *pk_digest)
   while ((circ = circuit_get_next_by_pk_and_purpose(circ,pk_digest,
                                                   CIRCUIT_PURPOSE_S_INTRO))) {
     tor_assert(circ->cpath);
-    /* XXX this is a bug. ->nickname will always be there. */
-    if (circ->build_state->chosen_exit->nickname &&
-        !strcasecmp(circ->build_state->chosen_exit->nickname, router->nickname)) {
+    if (!strcasecmp(circ->build_state->chosen_exit->nickname,
+                    router->nickname)) {
       return circ;
     }
   }
@@ -842,9 +841,8 @@ find_intro_circuit(routerinfo_t *router, const char *pk_digest)
   while ((circ = circuit_get_next_by_pk_and_purpose(circ,pk_digest,
                                         CIRCUIT_PURPOSE_S_ESTABLISH_INTRO))) {
     tor_assert(circ->cpath);
-    /* XXX this is a bug. ->nickname will always be there. */
-    if (circ->build_state->chosen_exit->nickname &&
-        !strcasecmp(circ->build_state->chosen_exit->nickname, router->nickname)) {
+    if (!strcasecmp(circ->build_state->chosen_exit->nickname,
+                    router->nickname)) {
       return circ;
     }
   }