Lines Matching refs:sfd
501 connection_new(struct g_gate_cinit *cinit, struct sockaddr *s, int sfd) in connection_new() argument
527 conn->c_sendfd = sfd; in connection_new()
529 conn->c_recvfd = sfd; in connection_new()
542 struct sockaddr *s, int sfd) in connection_add() argument
554 conn->c_sendfd = sfd; in connection_add()
562 conn->c_recvfd = sfd; in connection_add()
657 sendfail(int sfd, int error, const char *fmt, ...) in sendfail() argument
666 data = g_gate_send(sfd, &sinit, sizeof(sinit), 0); in sendfail()
917 handshake(struct sockaddr *from, int sfd) in handshake() argument
931 data = g_gate_recv(sfd, &ver, sizeof(ver), MSG_WAITALL); in handshake()
949 data = g_gate_send(sfd, &ver, sizeof(ver), 0); in handshake()
952 sendfail(sfd, errno, "Error while sending version packet: %s.", in handshake()
961 data = g_gate_recv(sfd, &cinit, sizeof(cinit), MSG_WAITALL); in handshake()
975 if (connection_add(conn, &cinit, from, sfd) == -1) { in handshake()
983 conn = connection_new(&cinit, from, sfd); in handshake()
985 sendfail(sfd, ENOMEM, in handshake()
995 sendfail(sfd, errno, NULL); in handshake()
1010 data = g_gate_send(sfd, &sinit, sizeof(sinit), 0); in handshake()
1013 sendfail(sfd, errno, "Error while sending initial packet: %s.", in handshake()
1041 int ch, sfd, tmpsfd; in main() local
1113 sfd = socket(AF_INET, SOCK_STREAM, 0); in main()
1114 if (sfd == -1) in main()
1121 g_gate_socket_settings(sfd); in main()
1123 if (bind(sfd, (struct sockaddr *)&serv, sizeof(serv)) == -1) in main()
1125 if (listen(sfd, 5) == -1) in main()
1134 tmpsfd = accept(sfd, &from, &fromlen); in main()
1146 close(sfd); in main()