X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=net.c;h=b2c9c43a81ad356ec021373c12d5c764fa5b76f4;hp=427ab0f0d2a3ebe3873eeff603422742b66a94b1;hb=35f1fc325ea80370bb00e7cfcafe457ab6aca27c;hpb=2fe2b6e212e8e0d09cd1a8fc95f7f2f3a1110485;ds=inline diff --git a/net.c b/net.c index 427ab0f0..b2c9c43a 100644 --- a/net.c +++ b/net.c @@ -19,11 +19,13 @@ #define AI_ADDRCONFIG 0 #endif +#include #include "para.h" #include "error.h" #include "net.h" #include "string.h" +#include "fd.h" /** Information about one encrypted connection. */ @@ -345,31 +347,6 @@ struct in_addr extract_v4_addr(const struct sockaddr_storage *ss) return ia; } -/* - * Write a buffer to a file descriptor, re-write on short writes. - * - * \param fd The file descriptor. - * \param buf The buffer to be sent. - * \param len The length of \a buf. - * - * \return Standard. In any case, the number of bytes that have been written is - * stored in \a len. - */ -static int write_all(int fd, const char *buf, size_t *len) -{ - size_t total = *len; - - assert(total); - *len = 0; - while (*len < total) { - int ret = write(fd, buf + *len, total - *len); - if (ret == -1) - return -ERRNO_TO_PARA_ERROR(errno); - *len += ret; - } - return 1; -} - /** * Encrypt and send a binary buffer. *