summary refs log tree commit diff
path: root/pkgs/tools/admin
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2015-06-18 22:23:55 +0200
committerVladimír Čunát <vcunat@gmail.com>2015-06-18 22:38:08 +0200
commit61596bf405de245c71630101869ea3f4e8f8a20a (patch)
treee712933bc34d25aba42b99907f879b5251585b29 /pkgs/tools/admin
parent8e19ac8d7cc7018613ff51d9266dea81547df756 (diff)
parentfe75f160324672d639469dc2da69f70d4eb466a4 (diff)
downloadnixlib-61596bf405de245c71630101869ea3f4e8f8a20a.tar
nixlib-61596bf405de245c71630101869ea3f4e8f8a20a.tar.gz
nixlib-61596bf405de245c71630101869ea3f4e8f8a20a.tar.bz2
nixlib-61596bf405de245c71630101869ea3f4e8f8a20a.tar.lz
nixlib-61596bf405de245c71630101869ea3f4e8f8a20a.tar.xz
nixlib-61596bf405de245c71630101869ea3f4e8f8a20a.tar.zst
nixlib-61596bf405de245c71630101869ea3f4e8f8a20a.zip
Merge #8363: pure-darwin stdenv
Diffstat (limited to 'pkgs/tools/admin')
-rw-r--r--pkgs/tools/admin/nxproxy/0660_nxcomp_fix-negotiation-in-stage-10-error.full+lite.patch67
-rw-r--r--pkgs/tools/admin/nxproxy/default.nix3
2 files changed, 69 insertions, 1 deletions
diff --git a/pkgs/tools/admin/nxproxy/0660_nxcomp_fix-negotiation-in-stage-10-error.full+lite.patch b/pkgs/tools/admin/nxproxy/0660_nxcomp_fix-negotiation-in-stage-10-error.full+lite.patch
new file mode 100644
index 000000000000..3d4c584fb078
--- /dev/null
+++ b/pkgs/tools/admin/nxproxy/0660_nxcomp_fix-negotiation-in-stage-10-error.full+lite.patch
@@ -0,0 +1,67 @@
+commit f982cbc85e9ffff24a6a348c3637b54a7e8cbc34
+Author: Vadim Troshchinskiy <vtroshchinskiy@qindel.com>
+Date:   Wed May 20 15:47:45 2015 +0200
+
+Fix negotiation in stage 10 error
+
+Problem fixed by adding a select() call to implement a timeout,
+and retrying writes if needed.
+
+v2: backport to nx-libs 3.5.0.x (Mihai Moldovan)
+
+--- a/nxcomp/Loop.cpp
++++ b/nxcomp/Loop.cpp
+@@ -8073,16 +8073,52 @@ int ReadRemoteData(int fd, char *buffer,
+ int WriteLocalData(int fd, const char *buffer, int size)
+ {
+   int position = 0;
++  int ret = 0;
++  fd_set writeSet;
++  struct timeval selectTs = {30, 0};
+ 
+   while (position < size)
+   {
++
++    // A write to a non-blocking socket may fail with EAGAIN. The problem is
++    // that cache data is done in several writes, and there's no easy way
++    // to handle failure without rewriting a significant amount of code.
++    //
++    // Bailing out of the outer loop would result in restarting the sending
++    // of the entire cache list, which would confuse the other side.
++
++    FD_ZERO(&writeSet);
++    FD_SET(fd, &writeSet);
++
++    ret = select(fd+1, NULL, &writeSet, NULL, &selectTs);
++
++    #ifdef DEBUG
++    *logofs << "Loop: WriteLocalData: select() returned with a code of " << ret << " and remaining timeout of "
++            << selectTs.tv_sec << " sec, " << selectTs.tv_usec << "usec\n" << logofs_flush;
++    #endif
++
++    if ( ret < 0 )
++    {
++      *logofs << "Loop: Error in select() when writing data to FD#" << fd << ": " << strerror(EGET()) << "\n" << logofs_flush;
++
++      if ( EGET() == EINTR )
++        continue;
++
++      return -1;
++    }
++    else if ( ret == 0 )
++    {
++      *logofs << "Loop: Timeout expired in select() when writing data to FD#" << fd << ": " << strerror(EGET()) << "\n" << logofs_flush;
++      return -1;
++    }
++
+     int result = write(fd, buffer + position, size - position);
+ 
+     getNewTimestamp();
+ 
+     if (result <= 0)
+     {
+-      if (result < 0 && EGET() == EINTR)
++      if (result < 0 && (EGET() == EINTR || EGET() == EAGAIN || EGET() == EWOULDBLOCK))
+       {
+         continue;
+       }
diff --git a/pkgs/tools/admin/nxproxy/default.nix b/pkgs/tools/admin/nxproxy/default.nix
index e9fe8f8f9c7d..20b8f4059ad8 100644
--- a/pkgs/tools/admin/nxproxy/default.nix
+++ b/pkgs/tools/admin/nxproxy/default.nix
@@ -21,7 +21,8 @@ stdenv.mkDerivation {
     ./0660_nxcomp_fix-negotiation-in-stage-10-error.full+lite.patch
   ];
 
-  buildInputs = [ autoreconfHook libxcomp ];
+  buildInputs = [ libxcomp ];
+  nativeBuildInputs = [ autoreconfHook ];
 
   preAutoreconf = ''
     cd nxproxy/