Commit 06c8740f authored by jan.koester's avatar jan.koester
Browse files

test

parent c52ff09e
Loading
Loading
Loading
Loading
+6 −0
Changes for src/event/iocp.cpp: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -210,6 +210,12 @@ namespace netplus {
        while (event::Running) {
            std::unique_ptr<socket> csock;

            // Pre-allocate the child socket based on server socket type
            // (ssl::accept handles its own allocation internally)
            if (serverSock->_Type == sockettype::TCP) {
                csock = std::make_unique<tcp>(INVALID_SOCKET);
            }

            try {
                serverSock->accept(csock, false);
            } catch (NetException& e) {
+4 −1
Changes for src/ssl.cpp: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -174,7 +174,10 @@ void ssl::accept(LPFN_ACCEPTEX lpfnAcceptEx, std::unique_ptr<socket>& csock) {
}

void ssl::prime_read() {
    // Prime read for IOCP - implementation depends on IOCP infrastructure
    // SSL uses the underlying TCP transport for raw I/O.
    // Post a WSARecv on the TCP socket so IOCP delivers the ClientHello
    // (and all subsequent TLS records) to the worker thread.
    tcp::prime_read();
}
#endif

+7 −1
Changes for src/windows/tcp.cpp: 7 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -127,13 +127,19 @@ tcp& tcp::operator=(SOCKET sock) {
}

void tcp::accept(std::unique_ptr<socket>& csock, bool nonblock) {
    if (!csock) {
        csock = std::make_unique<tcp>(INVALID_SOCKET);
    }

    sockaddr_storage peer{};
    int peerLen = sizeof(peer);

    SOCKET cfd = ::accept(_Socket, reinterpret_cast<sockaddr*>(&peer), &peerLen);
    if (cfd == INVALID_SOCKET) {
        int err = ::WSAGetLastError();
        NetException e;
        e[NetException::Error] << "tcp::accept failed";
        int et = (err == WSAEWOULDBLOCK) ? NetException::Note : NetException::Error;
        e[et] << "tcp::accept failed: " << err;
        throw e;
    }