/* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. $id$ */ #ifndef OT_TIMEOUT_H__ #define OT_TIMEOUT_H__ #include #include /* Libowfat */ #include "io.h" #include "trackerlogic.h" /* io_timeout wants an absolute TAI64 deadline and io_timeouted skips any socket whose deadline is zero, so that is how a socket is told to wait indefinitely. The deadline is taken from the cached clock rather than from gettimeofday, which is too expensive to call at this rate on FreeBSD. */ static inline void timeout_never(int64_t sock) { tai6464 t; memset(&t, 0, sizeof(t)); io_timeout(sock, t); } static inline void timeout_in(int64_t sock, unsigned int seconds) { tai6464 t; memset(&t, 0, sizeof(t)); tai_unix(&t.sec, g_now_seconds + seconds); io_timeout(sock, t); } #endif