Lines Matching refs:sfd
296 int sfd; in handshake() local
309 sfd = socket(AF_INET, SOCK_STREAM, 0); in handshake()
310 if (sfd == -1) { in handshake()
316 g_gate_socket_settings(sfd); in handshake()
318 if (connect(sfd, (struct sockaddr *)&serv, sizeof(serv)) == -1) { in handshake()
321 close(sfd); in handshake()
336 if (g_gate_send(sfd, &ver, sizeof(ver), MSG_NOSIGNAL) == -1) { in handshake()
339 close(sfd); in handshake()
343 if (g_gate_recv(sfd, &ver, sizeof(ver), MSG_WAITALL) == -1) { in handshake()
346 close(sfd); in handshake()
352 close(sfd); in handshake()
363 close(sfd); in handshake()
370 if (g_gate_send(sfd, &cinit, sizeof(cinit), MSG_NOSIGNAL) == -1) { in handshake()
373 close(sfd); in handshake()
382 if (g_gate_recv(sfd, &sinit, sizeof(sinit), MSG_WAITALL) == -1) { in handshake()
385 close(sfd); in handshake()
392 close(sfd); in handshake()
401 return (sfd); in handshake()