Deleted Added
full compact
31c31
< __FBSDID("$FreeBSD: head/sbin/hastd/proto.c 204076 2010-02-18 23:16:19Z pjd $");
---
> __FBSDID("$FreeBSD: head/sbin/hastd/proto.c 207371 2010-04-29 15:36:32Z pjd $");
32a33
> #include <sys/types.h>
33a35
> #include <sys/socket.h>
249a252,275
> int
> proto_timeout(const struct proto_conn *conn, int timeout)
> {
> struct timeval tv;
> int fd;
>
> assert(conn != NULL);
> assert(conn->pc_magic == PROTO_CONN_MAGIC);
> assert(conn->pc_proto != NULL);
>
> fd = proto_descriptor(conn);
> if (fd < 0)
> return (-1);
>
> tv.tv_sec = timeout;
> tv.tv_usec = 0;
> if (setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)) < 0)
> return (-1);
> if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0)
> return (-1);
>
> return (0);
> }
>