Commit a64953ed authored by unknown's avatar unknown

testBasic -n MassiveRollback

Make sure to not receive more that buffer can fit currently


ndb/src/common/transporter/TCP_Transporter.cpp:
  Make sure to not receive more that buffer can fit currently
parent 2de9ef17
...@@ -362,9 +362,12 @@ TCP_Transporter::doReceive() { ...@@ -362,9 +362,12 @@ TCP_Transporter::doReceive() {
// Select-function must return the socket for read // Select-function must return the socket for read
// before this method is called // before this method is called
// It reads the external TCP/IP interface once // It reads the external TCP/IP interface once
int size = receiveBuffer.sizeOfBuffer - receiveBuffer.sizeOfData;
if(size > 0){
const int nBytesRead = recv(theSocket, const int nBytesRead = recv(theSocket,
receiveBuffer.insertPtr, maxReceiveSize, 0); receiveBuffer.insertPtr,
size < maxReceiveSize ? size : maxReceiveSize,
0);
if (nBytesRead > 0) { if (nBytesRead > 0) {
receiveBuffer.sizeOfData += nBytesRead; receiveBuffer.sizeOfData += nBytesRead;
...@@ -406,6 +409,9 @@ TCP_Transporter::doReceive() { ...@@ -406,6 +409,9 @@ TCP_Transporter::doReceive() {
} }
} }
return nBytesRead; return nBytesRead;
} else {
return 0;
}
} }
void void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment