comparison dbutil.c @ 64:efb5e0b335cf

TCP forwarding works.
author Matt Johnston <matt@ucc.asn.au>
date Thu, 12 Aug 2004 13:48:42 +0000
parents dcc43965928f
children eee77ac31ccc
comparison
equal deleted inserted replaced
63:dcc43965928f 64:efb5e0b335cf
183 setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val)); 183 setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val));
184 184
185 if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) { 185 if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) {
186 err = errno; 186 err = errno;
187 close(sock); 187 close(sock);
188 TRACE(("bind() failed")); 188 TRACE(("bind(%s) failed", port));
189 continue; 189 continue;
190 } 190 }
191 191
192 if (listen(sock, 20) < 0) { 192 if (listen(sock, 20) < 0) {
193 err = errno; 193 err = errno;
204 if (nsock == 0) { 204 if (nsock == 0) {
205 if (errstring != NULL && *errstring == NULL) { 205 if (errstring != NULL && *errstring == NULL) {
206 int len; 206 int len;
207 len = 20 + strlen(strerror(err)); 207 len = 20 + strlen(strerror(err));
208 *errstring = (char*)m_malloc(len); 208 *errstring = (char*)m_malloc(len);
209 snprintf(*errstring, len, "Error connecting: %s", strerror(err)); 209 snprintf(*errstring, len, "Error listening: %s", strerror(err));
210 TRACE(("leave dropbear_listen: failure, %s", strerror(err))); 210 TRACE(("leave dropbear_listen: failure, %s", strerror(err)));
211 return -1; 211 return -1;
212 } 212 }
213 } 213 }
214 214