cygrunsrv + sshd + rsync = 20 times too slow -- throttled?

Takashi Yano takashi.yano@nifty.ne.jp
Wed Sep 15 11:54:33 GMT 2021


On Wed, 15 Sep 2021 13:13:25 +0200
Corinna Vinschen wrote:
> @@ -652,11 +652,15 @@ pipe_data_available (int fd, fhandler_base *fh, HANDLE h, bool writing)
>  	}
>        /* TODO: Buffer really full or non-Cygwin reader? */
>      }
> -  else if (fpli.ReadDataAvailable)
> +  else
>      {
> -      paranoid_printf ("fd %d, %s, read avail %u", fd, fh->get_name (),
> -		       fpli.ReadDataAvailable);
> -      return 1;
> +      DWORD nbytes_in_pipe;
> +      if (PeekNamedPipe (h, NULL, 0, NULL, &nbytes_in_pipe, NULL))
> +	{
> +	  paranoid_printf ("fd %d, %s, read avail %u", fd, fh->get_name (),
> +			   nbytes_in_pipe);
> +	  return nbytes_in_pipe > 0;
> +	}
>      }
>    if (fpli.NamedPipeState & FILE_PIPE_CLOSING_STATE)
>      return -1;

This shoudl be:

@@ -652,11 +652,17 @@ pipe_data_available (int fd, fhandler_base *fh, HANDLE h, bool writing)
 	}
       /* TODO: Buffer really full or non-Cygwin reader? */
     }
-  else if (fpli.ReadDataAvailable)
+  else
     {
-      paranoid_printf ("fd %d, %s, read avail %u", fd, fh->get_name (),
-		       fpli.ReadDataAvailable);
-      return 1;
+      DWORD nbytes_in_pipe;
+      if (PeekNamedPipe (h, NULL, 0, NULL, &nbytes_in_pipe, NULL))
+	{
+	  paranoid_printf ("fd %d, %s, read avail %u", fd, fh->get_name (),
+			   nbytes_in_pipe);
+	  return nbytes_in_pipe > 0;
+	}
+      else if (GetLastError () == ERROR_BROKEN_PIPE)
+	return -1;
     }
   if (fpli.NamedPipeState & FILE_PIPE_CLOSING_STATE)
     return -1;

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


More information about the Cygwin-developers mailing list