log connection compression status, bugfix

This commit is contained in:
Doug Hoyte
2023-01-20 14:17:00 -05:00
parent 9f2430fa64
commit cf7f92451f
3 changed files with 12 additions and 3 deletions

View File

@ -125,7 +125,14 @@ void RelayServer::runWebsocket(ThreadPool<MsgWebsocket>::Thread &thr) {
hubGroup->onConnection([&](uWS::WebSocket<uWS::SERVER> *ws, uWS::HttpRequest req) { hubGroup->onConnection([&](uWS::WebSocket<uWS::SERVER> *ws, uWS::HttpRequest req) {
std::string addr = ws->getAddress().address; std::string addr = ws->getAddress().address;
uint64_t connId = nextConnectionId++; uint64_t connId = nextConnectionId++;
LI << "[" << connId << "] Connect from " << addr;
bool compEnabled, compSlidingWindow;
ws->getCompressionState(compEnabled, compSlidingWindow);
LI << "[" << connId << "] Connect from " << addr
<< " compression=" << (compEnabled ? 'Y' : 'N')
<< " sliding=" << (compSlidingWindow ? 'Y' : 'N')
;
Connection *c = new Connection(ws, connId); Connection *c = new Connection(ws, connId);
c->ipAddr = addr; c->ipAddr = addr;
ws->setUserData((void*)c); ws->setUserData((void*)c);

View File

@ -29,7 +29,7 @@ struct WriterPipeline {
for (auto &m : msgs) { for (auto &m : msgs) {
if (m.is_null()) { if (m.is_null()) {
writerInbox.push_move({ "", "", 0 }); writerInbox.push_move({});
break; break;
} }

View File

@ -75,6 +75,8 @@ struct EventToWrite {
uint64_t nodeId = 0; uint64_t nodeId = 0;
EventWriteStatus status = EventWriteStatus::Pending; EventWriteStatus status = EventWriteStatus::Pending;
EventToWrite() {}
EventToWrite(std::string flatStr, std::string jsonStr, uint64_t receivedAt, void *userData = nullptr) : flatStr(flatStr), jsonStr(jsonStr), receivedAt(receivedAt), userData(userData) { EventToWrite(std::string flatStr, std::string jsonStr, uint64_t receivedAt, void *userData = nullptr) : flatStr(flatStr), jsonStr(jsonStr), receivedAt(receivedAt), userData(userData) {
const NostrIndex::Event *flat = flatbuffers::GetRoot<NostrIndex::Event>(flatStr.data()); const NostrIndex::Event *flat = flatbuffers::GetRoot<NostrIndex::Event>(flatStr.data());
quadKey = flatEventToQuadrableKey(flat); quadKey = flatEventToQuadrableKey(flat);