Home | History | Annotate | Download | only in dropbear

Lines Matching refs:sock

156 static void set_sock_priority(int sock) {
162 setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val));
168 setsockopt(sock, IPPROTO_IP, IP_TOS, (void*)&val, sizeof(val));
175 setsockopt(sock, SOL_SOCKET, SO_PRIORITY, (void*) &val, sizeof(val));
194 int sock;
241 sock = socks[nsock]; /* For clarity */
243 if (sock < 0) {
252 setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &val, sizeof(val));
255 setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&linger, sizeof(linger));
257 set_sock_priority(sock);
259 if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) {
261 close(sock);
266 if (listen(sock, 20) < 0) {
268 close(sock);
273 *maxfd = MAX(*maxfd, sock);
307 int sock;
332 sock = -1;
336 sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
337 if (sock < 0) {
343 if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) {
344 close(sock);
345 sock = -1;
354 if (connect(sock, res->ai_addr, res->ai_addrlen) < 0) {
360 close(sock);
361 sock = -1;
369 if (sock < 0 && !(errno == EINPROGRESS && nonblocking)) {
380 set_sock_priority(sock);
384 if (sock > 0 && errstring != NULL && *errstring != NULL) {
388 TRACE(("leave connect_remote: sock %d\n", sock))
389 return sock;