Unverified Commit 47037a2a authored by Dennis Jenkins's avatar Dennis Jenkins Committed by GitHub

Merge pull request #541 from dmorton-spirent/fix-bad-fd

Add error handling in cases of writing to an invalid file descriptor
parents 4355267e 0fc82a2e
......@@ -269,6 +269,14 @@ Transport::asyncWriteImpl(Fd fd)
wq.push_front(WriteEntry(std::move(deferred), bufferHolder, flags));
reactor()->modifyFd(key(), fd, NotifyOn::Read | NotifyOn::Write, Polling::Mode::Edge);
}
// EBADF can happen when the HTTP parser, in the case of
// an error, closes fd before the entire request is processed.
// https://github.com/oktal/pistache/issues/501
else if (errno == EBADF) {
wq.pop_front();
toWrite.erase(fd);
stop = true;
}
else {
cleanUp();
deferred.reject(Pistache::Error::system("Could not write data"));
......
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