sshconnect.c (162856) | sshconnect.c (164149) |
---|---|
1/* $OpenBSD: sshconnect.c,v 1.199 2006/08/03 03:34:42 deraadt Exp $ */ | 1/* $OpenBSD: sshconnect.c,v 1.200 2006/10/10 10:12:45 markus Exp $ */ |
2/* 3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 5 * All rights reserved 6 * Code to connect to a remote host, and to perform the client side of the 7 * login (authentication) dialog. 8 * 9 * As far as I am concerned, the code I have written for this software --- 309 unchanged lines hidden (view full) --- 319 hints.ai_family = family; 320 hints.ai_socktype = SOCK_STREAM; 321 snprintf(strport, sizeof strport, "%u", port); 322 if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) 323 fatal("%s: %.100s: %s", __progname, host, 324 gai_strerror(gaierr)); 325 326 for (attempt = 0; attempt < connection_attempts; attempt++) { | 2/* 3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 5 * All rights reserved 6 * Code to connect to a remote host, and to perform the client side of the 7 * login (authentication) dialog. 8 * 9 * As far as I am concerned, the code I have written for this software --- 309 unchanged lines hidden (view full) --- 319 hints.ai_family = family; 320 hints.ai_socktype = SOCK_STREAM; 321 snprintf(strport, sizeof strport, "%u", port); 322 if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) 323 fatal("%s: %.100s: %s", __progname, host, 324 gai_strerror(gaierr)); 325 326 for (attempt = 0; attempt < connection_attempts; attempt++) { |
327 if (attempt > 0) | 327 if (attempt > 0) { 328 /* Sleep a moment before retrying. */ 329 sleep(1); |
328 debug("Trying again..."); | 330 debug("Trying again..."); |
329 | 331 } |
330 /* 331 * Loop through addresses for this host, and try each one in 332 * sequence until the connection succeeds. 333 */ 334 for (ai = aitop; ai; ai = ai->ai_next) { 335 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) 336 continue; 337 if (getnameinfo(ai->ai_addr, ai->ai_addrlen, --- 20 unchanged lines hidden (view full) --- 358 debug("connect to address %s port %s: %s", 359 ntop, strport, strerror(errno)); 360 close(sock); 361 sock = -1; 362 } 363 } 364 if (sock != -1) 365 break; /* Successful connection. */ | 332 /* 333 * Loop through addresses for this host, and try each one in 334 * sequence until the connection succeeds. 335 */ 336 for (ai = aitop; ai; ai = ai->ai_next) { 337 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) 338 continue; 339 if (getnameinfo(ai->ai_addr, ai->ai_addrlen, --- 20 unchanged lines hidden (view full) --- 360 debug("connect to address %s port %s: %s", 361 ntop, strport, strerror(errno)); 362 close(sock); 363 sock = -1; 364 } 365 } 366 if (sock != -1) 367 break; /* Successful connection. */ |
366 367 /* Sleep a moment before retrying. */ 368 sleep(1); | |
369 } 370 371 freeaddrinfo(aitop); 372 373 /* Return failure if we didn't get a successful connection. */ 374 if (sock == -1) { 375 error("ssh: connect to host %s port %s: %s", 376 host, strport, strerror(errno)); --- 731 unchanged lines hidden --- | 368 } 369 370 freeaddrinfo(aitop); 371 372 /* Return failure if we didn't get a successful connection. */ 373 if (sock == -1) { 374 error("ssh: connect to host %s port %s: %s", 375 host, strport, strerror(errno)); --- 731 unchanged lines hidden --- |