version 1.90, 2015/01/30 04:45:45 |
version 1.91, 2015/02/09 08:24:20 |
|
|
|
|
s = -1; |
s = -1; |
for (res = res0; res; res = res->ai_next) { |
for (res = res0; res; res = res->ai_next) { |
#if 0 /*old behavior*/ |
|
if (res != res0) /* not on the first address */ |
|
#else |
|
if (res0->ai_next) /* if we have multiple possibilities */ |
if (res0->ai_next) /* if we have multiple possibilities */ |
#endif |
|
{ |
{ |
if (getnameinfo(res->ai_addr, res->ai_addrlen, |
if (getnameinfo(res->ai_addr, res->ai_addrlen, |
hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0) |
hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0) |
|
|
code = -1; |
code = -1; |
goto bad; |
goto bad; |
} |
} |
#if defined(IPPROTO_IP) && defined(IP_TOS) |
|
if (hisctladdr.su_family == AF_INET) { |
if (hisctladdr.su_family == AF_INET) { |
tos = IPTOS_LOWDELAY; |
tos = IPTOS_LOWDELAY; |
if (setsockopt(s, IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(int)) < 0) |
if (setsockopt(s, IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(int)) < 0) |
warn("setsockopt TOS (ignored)"); |
warn("setsockopt TOS (ignored)"); |
} |
} |
#endif |
|
cin = fdopen(s, "r"); |
cin = fdopen(s, "r"); |
cout = fdopen(s, "w"); |
cout = fdopen(s, "w"); |
if (cin == NULL || cout == NULL) { |
if (cin == NULL || cout == NULL) { |
|
|
code = -1; |
code = -1; |
goto bad; |
goto bad; |
} |
} |
#ifdef SO_OOBINLINE |
|
{ |
{ |
int ret, on = 1; |
int ret, on = 1; |
|
|
|
|
warn("setsockopt"); |
warn("setsockopt"); |
#endif /* !SMALL */ |
#endif /* !SMALL */ |
} |
} |
#endif /* SO_OOBINLINE */ |
|
|
|
return (hostname); |
return (hostname); |
bad: |
bad: |
|
|
} |
} |
(void)putc(c, dout); |
(void)putc(c, dout); |
bytes++; |
bytes++; |
#if 0 /* this violates RFC */ |
|
if (c == '\r') { |
|
(void)putc('\0', dout); |
|
bytes++; |
|
} |
|
#endif |
|
} |
} |
if (ferror(fin) || ferror(dout)) |
if (ferror(fin) || ferror(dout)) |
serrno = errno; |
serrno = errno; |
|
|
warn("connect"); |
warn("connect"); |
goto bad; |
goto bad; |
} |
} |
#if defined(IPPROTO_IP) && defined(IP_TOS) |
|
if (data_addr.su_family == AF_INET) { |
if (data_addr.su_family == AF_INET) { |
on = IPTOS_THROUGHPUT; |
on = IPTOS_THROUGHPUT; |
if (setsockopt(data, IPPROTO_IP, IP_TOS, (char *)&on, |
if (setsockopt(data, IPPROTO_IP, IP_TOS, (char *)&on, |
sizeof(int)) < 0) |
sizeof(int)) < 0) |
warn("setsockopt TOS (ignored)"); |
warn("setsockopt TOS (ignored)"); |
} |
} |
#endif |
|
return (0); |
return (0); |
} |
} |
|
|
|
|
} |
} |
if (tmpno) |
if (tmpno) |
sendport = 1; |
sendport = 1; |
#if defined(IPPROTO_IP) && defined(IP_TOS) |
|
if (data_addr.su_family == AF_INET) { |
if (data_addr.su_family == AF_INET) { |
on = IPTOS_THROUGHPUT; |
on = IPTOS_THROUGHPUT; |
if (setsockopt(data, IPPROTO_IP, IP_TOS, (char *)&on, |
if (setsockopt(data, IPPROTO_IP, IP_TOS, (char *)&on, |
sizeof(int)) < 0) |
sizeof(int)) < 0) |
warn("setsockopt TOS (ignored)"); |
warn("setsockopt TOS (ignored)"); |
} |
} |
#endif |
|
return (0); |
return (0); |
bad: |
bad: |
(void)close(data), data = -1; |
(void)close(data), data = -1; |
|
|
} |
} |
(void)close(data); |
(void)close(data); |
data = s; |
data = s; |
#if defined(IPPROTO_IP) && defined(IP_TOS) |
|
if (from.su_family == AF_INET) { |
if (from.su_family == AF_INET) { |
int tos = IPTOS_THROUGHPUT; |
int tos = IPTOS_THROUGHPUT; |
if (setsockopt(s, IPPROTO_IP, IP_TOS, (char *)&tos, |
if (setsockopt(s, IPPROTO_IP, IP_TOS, (char *)&tos, |
|
|
warn("setsockopt TOS (ignored)"); |
warn("setsockopt TOS (ignored)"); |
} |
} |
} |
} |
#endif |
|
return (fdopen(data, lmode)); |
return (fdopen(data, lmode)); |
} |
} |
|
|