pistache
pistache copied to clipboard
WriteEntry Constructor called with Incorrect Parameters in Transport::asyncWriteImpl
There is a fragment of code in transport.cc:
// pop_front kills buffer - so we cannot continue loop or use buffer
// after this point
wq.pop_front();
wq.push_front(WriteEntry(std::move(deferred), bufferHolder, flags));
BUT the WriteEntry constructor is:
WriteEntry(Async::Deferred<ssize_t> deferred_, BufferHolder buffer_,
Fd peerFd_, int flags_ = 0)
So this invocation of the WriteEntry constructor is passing variable flags as the input to Fd peerFd_. This only compiles because both flags and type Fd have type int, and then the missing WriteEntry constructor parameter (flags_) has a default value.
Can it be changed to:
wq.push_front(WriteEntry(std::move(deferred), bufferHolder, fd, flags));
(I think the parameter to add is fd? Not buffer.fd() or something else?)
Thanks!