@@ -1,67 +0,0 @@
1−commit f982cbc85e9ffff24a6a348c3637b54a7e8cbc34
2−Author: Vadim Troshchinskiy <vtroshchinskiy@qindel.com>
3−Date: Wed May 20 15:47:45 2015 +0200
4−
5−Fix negotiation in stage 10 error
6−
7−Problem fixed by adding a select() call to implement a timeout,
8−and retrying writes if needed.
9−
10−v2: backport to nx-libs 3.5.0.x (Mihai Moldovan)
11−
12−--- a/nxcomp/Loop.cpp
13−+++ b/nxcomp/Loop.cpp
14−@@ -8073,16 +8073,52 @@ int ReadRemoteData(int fd, char *buffer,
15− int WriteLocalData(int fd, const char *buffer, int size)
16− {
17− int position = 0;
18−+ int ret = 0;
19−+ fd_set writeSet;
20−+ struct timeval selectTs = {30, 0};
21−
22− while (position < size)
23− {
24−+
25−+ // A write to a non-blocking socket may fail with EAGAIN. The problem is
26−+ // that cache data is done in several writes, and there's no easy way
27−+ // to handle failure without rewriting a significant amount of code.
28−+ //
29−+ // Bailing out of the outer loop would result in restarting the sending
30−+ // of the entire cache list, which would confuse the other side.
31−+
32−+ FD_ZERO(&writeSet);
33−+ FD_SET(fd, &writeSet);
34−+
35−+ ret = select(fd+1, NULL, &writeSet, NULL, &selectTs);
36−+
37−+ #ifdef DEBUG
38−+ *logofs << "Loop: WriteLocalData: select() returned with a code of " << ret << " and remaining timeout of "
39−+ << selectTs.tv_sec << " sec, " << selectTs.tv_usec << "usec\n" << logofs_flush;
40−+ #endif
41−+
42−+ if ( ret < 0 )
43−+ {
44−+ *logofs << "Loop: Error in select() when writing data to FD#" << fd << ": " << strerror(EGET()) << "\n" << logofs_flush;
45−+
46−+ if ( EGET() == EINTR )
47−+ continue;
48−+
49−+ return -1;
50−+ }
51−+ else if ( ret == 0 )
52−+ {
53−+ *logofs << "Loop: Timeout expired in select() when writing data to FD#" << fd << ": " << strerror(EGET()) << "\n" << logofs_flush;
54−+ return -1;
55−+ }
56−+
57− int result = write(fd, buffer + position, size - position);
58−
59− getNewTimestamp();
60−
61− if (result <= 0)
62− {
63−- if (result < 0 && EGET() == EINTR)
64−+ if (result < 0 && (EGET() == EINTR || EGET() == EAGAIN || EGET() == EWOULDBLOCK))
65− {
66− continue;
67− }