Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
// cerr<<"nghttp2_session_mem_recv returned "<<readlen<<endl;
/* as long as we don't require a pause by returning nghttp2_error.NGHTTP2_ERR_PAUSE from a CB,
all data should be consumed before returning */
- if (readlen < 0 || static_cast<size_t>(readlen) < conn->d_inPos) {
+ if (readlen < 0) {
throw std::runtime_error("Fatal error while passing received data to nghttp2: " + std::string(nghttp2_strerror(static_cast<int>(readlen))));
}
+ if (static_cast<size_t>(readlen) < conn->d_inPos) {
+ throw std::runtime_error("Data was not entirely processed (" + std::to_string(readlen) + " bytes out of " + std::to_string(conn->d_inPos) + ") while passing received data to nghttp2");
+ }
struct timeval now{
.tv_sec = 0, .tv_usec = 0};