X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=send.h;h=75c13731bb1af9223a0a32fdc8c85792f04f3d50;hp=2c6c7274344a6aaa03c1cf7c844639ca87c4d0ab;hb=828d7e8cd8577775cb81b8c9abcd5d96a7483d9b;hpb=2ed89c59f0efcd0a2763f47c7d3455663241e623 diff --git a/send.h b/send.h index 2c6c7274..75c13731 100644 --- a/send.h +++ b/send.h @@ -84,3 +84,22 @@ struct sender { */ int (*client_cmds[NUM_SENDER_CMDS])(struct sender_command_data*); }; + + + +static inline int _write_ok(int fd) +{ + struct timeval tv = {0, 0}; + fd_set wfds; + int ret; +again: + FD_ZERO(&wfds); + FD_SET(fd, &wfds); + ret = select(fd + 1, NULL, &wfds, NULL, &tv); + if (ret < 0 && errno == EINTR) + goto again; + if (ret < 0) + ret = 0; + return ret; +} +