问题
I'm using phpseclib 0.3.1 for working with remote SFTP server. I have a script which downloads cover images from the SFTP, save them on my server and make updates in database.
I run this script for 7000 images and after nearly 10-12 minutes, it looks like script has stopped (but eventually I have found out that script entered an endless loop)
After some investigation, I have found the following details:
function
get($remote_file, $local_file = false)
from SFTP.php is called for downloading image fileIn this function
_get_sftp_packet()
is called in while(true) loop.In _get_sftp_packet() there is a call of
_get_channel_packet(NET_SFTP_CHANNEL);
And in _get_channel_packet() there is a call of
$response = $this->_get_binary_packet();
My problem that this $response is empty string. In function _get_sftp_packet()
length of this response is used as a decrement and if function returns empty string (or length 0) - I will never get out of the loop in _get_sftp_packet()
Did anyone face this problem? What empty response means for _get_binary_packet()
function?
I will appreciate any help.
回答1:
It's probably an issue with the window size handling. An issue that has been fixed for a while now.
You're running 0.3.1? The latest version is 0.3.10. You're like 5 versions behind.
来源:https://stackoverflow.com/questions/28639927/phpseclib-endless-downloading