diff options
author | Fabio Riga <rifabio@dpersonam.me> | 2015-02-27 17:27:16 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2015-03-16 12:04:41 +0000 |
commit | a2225b51a19076ad46c069573c500742d771556f (patch) | |
tree | 6eefec3be86cf0863f856232915d361bcd464732 /testing/sane/10-network.patch | |
parent | 0c857465fd1158fd67381b697b4d4a046737bf1d (diff) | |
download | aports-a2225b51a19076ad46c069573c500742d771556f.tar.bz2 aports-a2225b51a19076ad46c069573c500742d771556f.tar.xz |
testing/sane: new port
http://www.sane-project.org
Scanner Access Now Easy
Diffstat (limited to 'testing/sane/10-network.patch')
-rw-r--r-- | testing/sane/10-network.patch | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/testing/sane/10-network.patch b/testing/sane/10-network.patch new file mode 100644 index 0000000000..4e422e28d2 --- /dev/null +++ b/testing/sane/10-network.patch @@ -0,0 +1,42 @@ +diff --git a/sanei/sanei_tcp.c b/sanei/sanei_tcp.c +index a57d7c7..d0a1e92 100644 +--- a/sanei/sanei_tcp.c ++++ b/sanei/sanei_tcp.c +@@ -45,6 +45,7 @@ + #include <unistd.h> + #include <stdlib.h> + #include <string.h> ++#include <time.h> + + #ifdef HAVE_WINSOCK2_H + #include <winsock2.h> +@@ -123,14 +124,27 @@ sanei_tcp_write(int fd, const u_char * buf, int count) + ssize_t + sanei_tcp_read(int fd, u_char * buf, int count) + { +- ssize_t bytes_recv = 0, rc = 1; ++ ssize_t bytes_recv = 0, rc = 1; ++ int retry = 5; + + while (bytes_recv < count && rc > 0) + { + rc = recv(fd, buf+bytes_recv, count-bytes_recv, 0); ++ DBG(1, "%s: bytes received %d\n", __FUNCTION__, rc); + if (rc > 0) + bytes_recv += rc; +- ++ else { ++ if ( errno == EAGAIN && retry-- ) { ++ DBG(1, "%s: waiting %d\n", __FUNCTION__, retry); ++ /* wait for max 1s */ ++ struct timespec req; ++ struct timespec rem; ++ req.tv_sec = 0; ++ req.tv_nsec= 100000000; ++ nanosleep(&req, &rem); ++ rc = 1; ++ } ++ } + } + return bytes_recv; + } |