summaryrefslogtreecommitdiff
path: root/user/sane/network.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-07-22 04:12:22 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-07-22 04:12:22 -0500
commitcf52e9dae453c12b464b77209f060fe9567067fd (patch)
tree5681828bc32bdcebdea33eabef606fc65bccecf5 /user/sane/network.patch
parent53c618caf21b41cb67739e74a82cf72048aa848e (diff)
downloadpackages-cf52e9dae453c12b464b77209f060fe9567067fd.tar.gz
packages-cf52e9dae453c12b464b77209f060fe9567067fd.tar.bz2
packages-cf52e9dae453c12b464b77209f060fe9567067fd.tar.xz
packages-cf52e9dae453c12b464b77209f060fe9567067fd.zip
user/sane: somewhat fix Alpine package. still [ugh] though
Diffstat (limited to 'user/sane/network.patch')
-rw-r--r--user/sane/network.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/user/sane/network.patch b/user/sane/network.patch
new file mode 100644
index 000000000..4e422e28d
--- /dev/null
+++ b/user/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;
+ }