diff --git a/pscp.c b/pscp.c index f6f6c206..9ea423fd 100644 --- a/pscp.c +++ b/pscp.c @@ -658,6 +658,10 @@ int sftp_senddata(char *buf, int len) back->send(backhandle, buf, len); return 1; } +int sftp_sendbuffer(void) +{ + return back->sendbuffer(backhandle); +} /* ---------------------------------------------------------------------- * sftp-based replacement for the hacky `pscp -ls'. diff --git a/psftp.c b/psftp.c index 784c81b1..a718b794 100644 --- a/psftp.c +++ b/psftp.c @@ -2618,6 +2618,10 @@ int sftp_senddata(char *buf, int len) back->send(backhandle, buf, len); return 1; } +int sftp_sendbuffer(void) +{ + return back->sendbuffer(backhandle); +} /* * Short description of parameters. diff --git a/sftp.c b/sftp.c index b4421f77..591b60ba 100644 --- a/sftp.c +++ b/sftp.c @@ -1349,7 +1349,7 @@ struct fxp_xfer *xfer_upload_init(struct fxp_handle *fh, uint64 offset) int xfer_upload_ready(struct fxp_xfer *xfer) { - if (xfer->req_totalsize < xfer->req_maxsize) + if (sftp_sendbuffer() == 0) return 1; else return 0; diff --git a/sftp.h b/sftp.h index c61340c1..309845b0 100644 --- a/sftp.h +++ b/sftp.h @@ -63,8 +63,12 @@ * until len is available, or it returns failure. * * Both functions return 1 on success, 0 on failure. + * + * sftp_sendbuffer returns the size of the backlog of data in the + * transmit queue. */ int sftp_senddata(char *data, int len); +int sftp_sendbuffer(void); int sftp_recvdata(char *data, int len); /*