move last patch down a little so it applies to tcp sockets as well as udp
authorKen Raeburn <raeburn@mit.edu>
Sat, 28 Aug 2004 00:25:24 +0000 (00:25 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 28 Aug 2004 00:25:24 +0000 (00:25 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16695 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/os/sendto_kdc.c

index 47cc2bce87fd9c48bb039fd660d71c66c18170ef..599c28515cbeac1ed34d869d059d2b90b67afa53 100644 (file)
@@ -632,23 +632,24 @@ start_connection (struct conn_state *state, struct select_state *selstate)
            state->state = FAILED;
            return -3;
        } else {
-#ifdef DEBUG
-           struct sockaddr_storage ss;
-           socklen_t sslen = sizeof(ss);
-           if (0 == getsockname(state->fd, (struct sockaddr *) &ss, &sslen)) {
-               struct addrinfo hack_ai;
-               memset(&hack_ai, 0, sizeof(hack_ai));
-               hack_ai.ai_addr = (struct sockaddr *) &ss;
-               hack_ai.ai_addrlen = sslen;
-               hack_ai.ai_socktype = SOCK_DGRAM;
-               hack_ai.ai_family = ai->ai_family;
-               dprint("local address used was %A\n", &hack_ai);
-           }
-#endif
            state->state = READING;
        }
     }
-
+#ifdef DEBUG
+    if (debug) {
+       struct sockaddr_storage ss;
+       socklen_t sslen = sizeof(ss);
+       if (getsockname(state->fd, (struct sockaddr *)&ss, &sslen) == 0) {
+           struct addrinfo hack_ai;
+           memset(&hack_ai, 0, sizeof(hack_ai));
+           hack_ai.ai_addr = (struct sockaddr *) &ss;
+           hack_ai.ai_addrlen = sslen;
+           hack_ai.ai_socktype = SOCK_DGRAM;
+           hack_ai.ai_family = ai->ai_family;
+           dprint("local socket address is %A\n", &hack_ai);
+       }
+    }
+#endif
     FD_SET(state->fd, &selstate->rfds);
     if (state->state == CONNECTING || state->state == WRITING)
        FD_SET(state->fd, &selstate->wfds);