Zero buffer for test before buffer read.
This commit is contained in:
parent
ec39c1df1a
commit
7e43656c5c
@ -110,6 +110,9 @@ namespace core {
|
|||||||
int len;
|
int len;
|
||||||
int error = -1;
|
int error = -1;
|
||||||
|
|
||||||
|
for(int ix = 0; ix < buffer.getLength(); ++ix)
|
||||||
|
buffer[ix] = 0;
|
||||||
|
|
||||||
if((len = ::read(getDescriptor(), buffer.getData(), buffer.getLength())) >= 0) {
|
if((len = ::read(getDescriptor(), buffer.getData(), buffer.getLength())) >= 0) {
|
||||||
coreutils::ZString zbuffer(buffer.getData(), len);
|
coreutils::ZString zbuffer(buffer.getData(), len);
|
||||||
onDataReceived(zbuffer);
|
onDataReceived(zbuffer);
|
||||||
@ -167,7 +170,7 @@ namespace core {
|
|||||||
coreutils::Log(coreutils::LOG_DEBUG_2) << "Shutdown requested on socket " << descriptor << " with reason " << text << ".";
|
coreutils::Log(coreutils::LOG_DEBUG_2) << "Shutdown requested on socket " << descriptor << " with reason " << text << ".";
|
||||||
shutDown = true;
|
shutDown = true;
|
||||||
reset = false;
|
reset = false;
|
||||||
// if(!needsToWrite())
|
// if(!needsToWrite())
|
||||||
delete this;
|
delete this;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user