Class NetworkConfig

  • All Implemented Interfaces:

    
    public final class NetworkConfig
    
                        

    Settings-group for the timeouts applied to every outbound HTTP call ServerPackCreator makes.

    These exist because the JDK's default is to wait forever: an HttpURLConnection with no timeouts set never gives up on a host which accepts the connection and then goes silent, which is exactly what a black-holing firewall or a stalled upstream looks like. Twelve manifest checks sit on the blocking startup path, so an unbounded wait there is a hang with no recovery rather than a slow start.

    Two timeouts are separate on purpose, because they answer different questions:

    • connect bounds reaching the host at all, and can be short — either the TCP handshake completes quickly or the host is not there.

    • read bounds how long a single read may block waiting for bytes. It is not a budget for the whole transfer, which is why a multi-megabyte download does not need a huge value — only a host that stalls mid-stream for longer than the timeout trips it.

    downloadReadTimeout is nevertheless separate from readTimeout because the two are used against different things: a metadata manifest either answers promptly or is broken, while an installer or mod jar is legitimately served by hosts that trickle bytes under load.

    • Method Detail

      • getFallbackConnectTimeout

         final Integer getFallbackConnectTimeout()

        Fallback milliseconds to wait for a connection to be established. Short by design: a reachable host completes the handshake in well under this, so a longer value only prolongs the wait on hosts which are not there.

      • getFallbackDownloadReadTimeout

         final Integer getFallbackDownloadReadTimeout()

        Fallback milliseconds a single read of a file-download may block. Larger than fallbackReadTimeout because installers and mod jars are served by hosts which trickle bytes under load, where a stalled metadata endpoint is simply broken.

      • getConnectTimeout

         final Integer getConnectTimeout()

        Milliseconds to wait for a connection to be established before giving up.

        See sanitise for how invalid values are handled, and note that 0 is a deliberate escape hatch meaning "wait forever" — the JDK's own semantics, and the behaviour SPC had before these settings existed.

      • setConnectTimeout

         final Unit setConnectTimeout(Integer value)

        Milliseconds to wait for a connection to be established before giving up.

        See sanitise for how invalid values are handled, and note that 0 is a deliberate escape hatch meaning "wait forever" — the JDK's own semantics, and the behaviour SPC had before these settings existed.

      • getReadTimeout

         final Integer getReadTimeout()

        Milliseconds a single read of a metadata response (version manifests, reachability checks) may block before the call gives up.

      • setReadTimeout

         final Unit setReadTimeout(Integer value)

        Milliseconds a single read of a metadata response (version manifests, reachability checks) may block before the call gives up.

      • getDownloadReadTimeout

         final Integer getDownloadReadTimeout()

        Milliseconds a single read of a file-download (installers, mod jars) may block before the download is abandoned.

      • setDownloadReadTimeout

         final Unit setDownloadReadTimeout(Integer value)

        Milliseconds a single read of a file-download (installers, mod jars) may block before the download is abandoned.