aboutsummaryrefslogtreecommitdiffstats
path: root/community/sane/network.patch
diff options
context:
space:
mode:
authorRasmus Thomsen <oss@cogitri.dev>2019-05-08 07:11:59 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2019-06-05 17:48:01 +0000
commit815d46044815e090806f9f0c729ede697013584b (patch)
treec5910b29c70f24c33008c74ebb4d61a0507d6291 /community/sane/network.patch
parent1b1801a0870bae9e2b35b661cc09c183477ef920 (diff)
downloadaports-815d46044815e090806f9f0c729ede697013584b.tar.bz2
aports-815d46044815e090806f9f0c729ede697013584b.tar.xz
community/sane: move from testing
It's required for simple-scanner. Modernize the APKBUILD while I'm at it.
Diffstat (limited to 'community/sane/network.patch')
-rw-r--r--community/sane/network.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/community/sane/network.patch b/community/sane/network.patch
new file mode 100644
index 0000000000..4e422e28d2
--- /dev/null
+++ b/community/sane/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;
+ }