mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-30 01:46:11 -05:00
found and corrected this bug about wrong packet size. This took me the WE, but I have a great deal of patience ;-)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1046 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b0668b1f48
commit
f98c8153a6
@ -1396,16 +1396,12 @@ int pqissl::senddata(void *data, int len)
|
||||
|
||||
int pqissl::readdata(void *data, int len)
|
||||
{
|
||||
int tmppktlen = SSL_read(ssl_connection, data, len);
|
||||
if (len != tmppktlen)
|
||||
int total_len = 0 ;
|
||||
do
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "pqissl::readdata()";
|
||||
out << " Full Packet Not read!" << std::endl;
|
||||
out << " -> Expected len(" << len << ") actually read(";
|
||||
out << tmppktlen << ")" << std::endl;
|
||||
rslog(RSL_WARNING, pqisslzone, out.str());
|
||||
}
|
||||
int tmppktlen = SSL_read(ssl_connection, (void*)((unsigned long int)data+(unsigned long int)total_len), len-total_len);
|
||||
|
||||
std::cerr <<"pqissl: read " << tmppktlen+total_len << " bytes. expected " << len << ", still " << len-(tmppktlen+total_len) << " to read"<< std::endl ;
|
||||
// need to catch errors.....
|
||||
if (tmppktlen <= 0) // probably needs a reset.
|
||||
{
|
||||
@ -1487,8 +1483,22 @@ int pqissl::readdata(void *data, int len)
|
||||
rslog(RSL_ALERT, pqisslzone, out.str());
|
||||
//exit(1);
|
||||
}
|
||||
else
|
||||
total_len+=tmppktlen ;
|
||||
} while(total_len < len) ;
|
||||
|
||||
if (len != total_len)
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "pqissl::readdata()";
|
||||
out << " Full Packet Not read!" << std::endl;
|
||||
out << " -> Expected len(" << len << ") actually read(";
|
||||
out << total_len << ")" << std::endl;
|
||||
std::cerr << out.str() ;
|
||||
rslog(RSL_WARNING, pqisslzone, out.str());
|
||||
}
|
||||
n_read_zero = 0;
|
||||
return tmppktlen;
|
||||
return len;//tmppktlen;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user