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

udp: report ECONNREFUSED from recvBatchAddrViews; quic: update the decrypt task numbers

parent 179a0456
Loading
Loading
Loading
Loading
+8 −0
Changes for src/posix/udp.cpp: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -777,6 +777,14 @@ size_t udp::recvBatchAddrViews(std::vector<DatagramView>& out,
    return out.size();
#else
    int received = recvBatchRaw(_Socket, batch, _gro_enabled);
    // A connected socket gets the ICMP "port unreachable" as ECONNREFUSED: nobody
    // listens there, which a QUIC handshake would otherwise only learn by timing
    // out. Clients fall back to TCP or mark the node dead on this.
    if (received < 0 && errno == ECONNREFUSED) {
        NetException e;
        e[NetException::Error] << "udp: connection refused";
        throw e;
    }
    if (received <= 0) return 0;

    for (int i = 0; i < received; ++i) {
+2 −2
Changes for src/quic.cpp: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -124,8 +124,8 @@ ThreadPool& quicDispatchPool() {
//
// Off by default (QUIC_PARALLEL_DECRYPT=1 enables it): on the loopback bulk
// benchmark, with GRO batches of ~24 packets, the fan-out costs more than it
// saves, 270 MB/s against 800+ without. Each packet is one task, which is far
// too fine-grained for a decrypt of under a microsecond per KB.
// saves, 450-690 MB/s against 1000+ without. One task per packet is too
// fine-grained for what a single decrypt costs.
ThreadPool& quicDecryptPool() {
    static ThreadPool pool((std::max<unsigned>)(2, std::thread::hardware_concurrency()));
    return pool;