Lines Matching refs:conn
340 struct connection *conn;
343 FOREACH_ELT(connections, i, conn)
344 if (conn == xconn) {
730 static void process_packet(struct connection *conn, const char *prog,
742 int port_fd = conn->fd;
799 static void accept_tcp_connection(struct connection *conn, const char *prog,
810 s = accept(conn->fd, addr, &addrlen);
895 kill_tcp_connection(struct connection *conn)
897 if (conn->u.tcp.response)
898 krb5_free_data(kdc_context, conn->u.tcp.response);
899 if (conn->u.tcp.buffer)
900 free(conn->u.tcp.buffer);
901 FD_CLR(conn->fd, &sstate.rfds);
902 FD_CLR(conn->fd, &sstate.wfds);
903 if (sstate.max == conn->fd + 1)
910 close(conn->fd);
911 conn->fd = -1;
912 delete_fd(conn);
949 process_tcp_connection(struct connection *conn, const char *prog, int selflags)
955 nwrote = SOCKET_WRITEV(conn->fd, conn->u.tcp.sgp, conn->u.tcp.sgnum,
964 sg_buf *sgp = conn->u.tcp.sgp;
970 conn->u.tcp.sgp++;
971 conn->u.tcp.sgnum--;
972 if (conn->u.tcp.sgnum == 0 && nwrote != 0)
976 if (conn->u.tcp.sgnum == 0) {
991 if (conn->u.tcp.offset < 4) {
996 len = 4 - conn->u.tcp.offset;
997 nread = SOCKET_READ(conn->fd,
998 conn->u.tcp.buffer + conn->u.tcp.offset, len);
1005 conn->u.tcp.offset += nread;
1006 if (conn->u.tcp.offset == 4) {
1007 unsigned char *p = (unsigned char *)conn->u.tcp.buffer;
1008 conn->u.tcp.msglen = ((p[0] << 24)
1012 if (conn->u.tcp.msglen > conn->u.tcp.bufsiz - 4) {
1016 conn->u.tcp.addrbuf, (unsigned long) conn->u.tcp.msglen,
1017 (unsigned long) conn->u.tcp.bufsiz - 4);
1019 err = make_toolong_error (&conn->u.tcp.response);
1034 len = conn->u.tcp.msglen - (conn->u.tcp.offset - 4);
1035 nread = SOCKET_READ(conn->fd,
1036 conn->u.tcp.buffer + conn->u.tcp.offset, len);
1043 conn->u.tcp.offset += nread;
1044 if (conn->u.tcp.offset < conn->u.tcp.msglen + 4)
1047 request.length = conn->u.tcp.msglen;
1048 request.data = conn->u.tcp.buffer + 4;
1049 err = dispatch(&request, &conn->u.tcp.faddr,
1050 &conn->u.tcp.response);
1056 conn->u.tcp.lenbuf[0] = 0xff & (conn->u.tcp.response->length >> 24);
1057 conn->u.tcp.lenbuf[1] = 0xff & (conn->u.tcp.response->length >> 16);
1058 conn->u.tcp.lenbuf[2] = 0xff & (conn->u.tcp.response->length >> 8);
1059 conn->u.tcp.lenbuf[3] = 0xff & (conn->u.tcp.response->length >> 0);
1060 SG_SET(&conn->u.tcp.sgbuf[1], conn->u.tcp.response->data,
1061 conn->u.tcp.response->length);
1062 conn->u.tcp.sgp = conn->u.tcp.sgbuf;
1063 conn->u.tcp.sgnum = 2;
1064 FD_CLR(conn->fd, &sstate.rfds);
1065 FD_SET(conn->fd, &sstate.wfds);
1073 kill_tcp_connection(conn);
1076 static void service_conn(struct connection *conn, const char *prog,
1079 conn->service(conn, prog, selflags);
1132 struct connection *conn;
1137 FOREACH_ELT (connections, i, conn) {
1138 if (conn->fd >= 0)
1139 (void) close(conn->fd);
1145 free(conn);