Mercurial > pidgin.yaz
comparison src/proxy.c @ 2905:a090e98dbbb6
[gaim-migrate @ 2918]
i've been in a friendly mood the last week
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 20 Dec 2001 21:01:59 +0000 |
parents | 7e82b69b03b7 |
children | 538c58b43eff |
comparison
equal
deleted
inserted
replaced
2904:3a9bca5fedcf | 2905:a090e98dbbb6 |
---|---|
156 int fd = -1; | 156 int fd = -1; |
157 | 157 |
158 debug_printf("connecting to %s:%d with no proxy\n", host, port); | 158 debug_printf("connecting to %s:%d with no proxy\n", host, port); |
159 | 159 |
160 if (!(hp = gethostbyname(host))) { | 160 if (!(hp = gethostbyname(host))) { |
161 debug_printf("gethostbyname failed\n"); | |
161 g_free(phb); | 162 g_free(phb); |
162 return -1; | 163 return -1; |
163 } | 164 } |
164 | 165 |
165 memset(&sin, 0, sizeof(struct sockaddr_in)); | 166 memset(&sin, 0, sizeof(struct sockaddr_in)); |
166 memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length); | 167 memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length); |
167 sin.sin_family = hp->h_addrtype; | 168 sin.sin_family = hp->h_addrtype; |
168 sin.sin_port = htons(port); | 169 sin.sin_port = htons(port); |
169 | 170 |
170 if ((fd = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) { | 171 if ((fd = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) { |
172 debug_printf("unable to create socket\n"); | |
171 g_free(phb); | 173 g_free(phb); |
172 return -1; | 174 return -1; |
173 } | 175 } |
174 | 176 |
175 fcntl(fd, F_SETFL, O_NONBLOCK); | 177 fcntl(fd, F_SETFL, O_NONBLOCK); |
187 unsigned int len; | 189 unsigned int len; |
188 int error = ETIMEDOUT; | 190 int error = ETIMEDOUT; |
189 debug_printf("Connect didn't block\n"); | 191 debug_printf("Connect didn't block\n"); |
190 len = sizeof(error); | 192 len = sizeof(error); |
191 if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { | 193 if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { |
194 debug_printf("getsockopt failed\n"); | |
192 close(fd); | 195 close(fd); |
193 g_free(phb); | 196 g_free(phb); |
194 return -1; | 197 return -1; |
195 } | 198 } |
196 fcntl(fd, F_SETFL, 0); | 199 fcntl(fd, F_SETFL, 0); |