Loading src/event/kqueue.cpp +25 −1 Changes for src/event/kqueue.cpp: 25 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -461,11 +461,35 @@ namespace netplus { evconnection->RequestEvent(*c, tid, args); } if (wouldBlock) { // The TLS layer may hold a partial record // but can't decrypt it yet. Pull more raw // TCP data so the record can be completed // without waiting for another kqueue event. bool gotMore = false; try { buffer prBuf(BLOCKSIZE); size_t pr = c->csock->prime_recv(prBuf, 0); if (pr > 0) gotMore = true; } catch (NetException&) { // EAGAIN / would-block — no more kernel data } if (!gotMore) break; continue; // retry recvData with the new raw bytes } // Continue only if there are more buffered records if (wouldBlock || rcv == 0 || !c->csock->hasBufferedData()) if (rcv == 0 || !c->csock->hasBufferedData()) break; } // EV_ONESHOT removes the filter after it fires. // Always re-arm READ so we catch future data even // if the loop above produced nothing (e.g. handshake // just finished and no app data arrived yet). if (!needClose) rearm.rearm_read(); // Step 4: Flush and send // Always attempt to send if there is data queued if ((!c->SendData.empty() || c->csock->hasPendingWrite()) && !needClose) { Loading Loading
src/event/kqueue.cpp +25 −1 Changes for src/event/kqueue.cpp: 25 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -461,11 +461,35 @@ namespace netplus { evconnection->RequestEvent(*c, tid, args); } if (wouldBlock) { // The TLS layer may hold a partial record // but can't decrypt it yet. Pull more raw // TCP data so the record can be completed // without waiting for another kqueue event. bool gotMore = false; try { buffer prBuf(BLOCKSIZE); size_t pr = c->csock->prime_recv(prBuf, 0); if (pr > 0) gotMore = true; } catch (NetException&) { // EAGAIN / would-block — no more kernel data } if (!gotMore) break; continue; // retry recvData with the new raw bytes } // Continue only if there are more buffered records if (wouldBlock || rcv == 0 || !c->csock->hasBufferedData()) if (rcv == 0 || !c->csock->hasBufferedData()) break; } // EV_ONESHOT removes the filter after it fires. // Always re-arm READ so we catch future data even // if the loop above produced nothing (e.g. handshake // just finished and no app data arrived yet). if (!needClose) rearm.rearm_read(); // Step 4: Flush and send // Always attempt to send if there is data queued if ((!c->SendData.empty() || c->csock->hasPendingWrite()) && !needClose) { Loading