Commit f05848a3 authored by jan.koester's avatar jan.koester
Browse files

test

parent 1e60964a
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -3115,7 +3115,17 @@ namespace netplus {
            size_t remaining = send_record.size() - send_off;
            buffer raw_buf((const char*)(send_record.data() + send_off), remaining);

            size_t sent = _socket->sendRaw(raw_buf, 0);
            size_t sent = 0;
            try {
                sent = _socket->sendRaw(raw_buf, 0);
            } catch (NetException& e) {
                if (e.getErrorType() == NetException::Note) {
                    // IOCP write already pending — stop flushing;
                    // records remain queued for the next write completion.
                    return;
                }
                throw;
            }
            send_off += sent;

            if (send_off < send_record.size()) {
+41 −0
Original line number Diff line number Diff line
@@ -415,6 +415,9 @@ namespace netplus {
                                if (e.getErrorType() == NetException::Note) {
                                    if (owner->slots[0].csock->hasPendingWrite()) {
                                        try { owner->slots[0].csock->flush_out(); } catch (...) {}
                                        if (owner->slots[0].csock->hasPendingWrite()) {
                                            owner->slots[0].WritePending.store(true);
                                        }
                                    }
                                    owner->slots[0].ReadPending.store(false);
                                    try { post_recv(st, *owner); } catch (...) {}
@@ -525,12 +528,50 @@ namespace netplus {
                            owner->slots[0].csock->setPendingWrite(false);

                            std::lock_guard<std::recursive_mutex> hsLock(owner->event_mutex);

                            // Flush remaining queued TLS records from a previous
                            // flight before re-entering the handshake state machine.
                            if (owner->slots[0].csock->hasPendingWrite()) {
                                try {
                                    owner->slots[0].csock->flush_out();
                                } catch (NetException& fe) {
                                    if (fe.getErrorType() != NetException::Note) {
                                        try_cleanup_con(ev, st, owner, cs, tid);
                                        continue;
                                    }
                                } catch (...) {
                                    try_cleanup_con(ev, st, owner, cs, tid);
                                    continue;
                                }
                                // If flush posted a new IOCP write, wait for it
                                if (owner->slots[0].csock->hasPendingWrite()) {
                                    owner->slots[0].WritePending.store(true);
                                    continue;
                                }
                            }

                            try {
                                owner->slots[0].csock->handshake_after_accept();

                                // After handshake step, flush any newly queued records
                                if (owner->slots[0].csock->hasPendingWrite()) {
                                    try { owner->slots[0].csock->flush_out(); } catch (...) {}
                                    if (owner->slots[0].csock->hasPendingWrite()) {
                                        owner->slots[0].WritePending.store(true);
                                        continue;
                                    }
                                }

                                try { post_recv(st, *owner); } catch (...) {}
                            } catch (NetException& e) {
                                if (e.getErrorType() == NetException::Note) {
                                    if (owner->slots[0].csock->hasPendingWrite()) {
                                        try { owner->slots[0].csock->flush_out(); } catch (...) {}
                                        if (owner->slots[0].csock->hasPendingWrite()) {
                                            owner->slots[0].WritePending.store(true);
                                            continue;
                                        }
                                    }
                                    try { post_recv(st, *owner); } catch (...) {}
                                } else {
                                    try_cleanup_con(ev, st, owner, cs, tid);