Add more checks and warnings for cork buffer misuse

This commit is contained in:
Alex Hultman
2021-09-12 16:51:50 +02:00
parent 78d20fd103
commit c35d6c1bb8
2 changed files with 10 additions and 1 deletions
+7
View File
@@ -22,6 +22,7 @@
#include "LoopData.h"
#include <libusockets.h>
#include <iostream>
namespace uWS {
struct Loop {
@@ -56,6 +57,12 @@ private:
for (auto &p : loopData->postHandlers) {
p.second((Loop *) loop);
}
/* After every event loop iteration, we must not hold the cork buffer */
if (loopData->corkedSocket) {
std::cerr << "Error: Cork buffer must not be held across event loop iterations!" << std::endl;
std::terminate();
}
}
Loop() = delete;