QtCraft API C++ classes QML types Handbook

QcJoinFailure Struct

Why joining a server failed (decision E-964): the step that failed as a kind, the address and the IP addresses tried, a translated reason and a hint what to check. More...

Header: #include <network/QcJoinFailure.h>

Public Types

enum class Kind { Other, LookupFailed, LookupTimedOut, TimedOut, Refused, …, LoginRefused }
enum class Step { Lookup, Connecting, Handshake }

Public Functions

QString hint() const
QString logText() const
bool triedOnlyIpv6() const
QString triedText() const

Public Variables

QcServerAddress address
QString detail
QcJoinFailure::Kind kind
QString reason
QStringList steps
QList<QHostAddress> tried

Static Public Members

QcJoinFailure::Kind kindOf(QAbstractSocket::SocketError error, QcJoinFailure::Step step)
QcJoinFailure of(QcJoinFailure::Kind kind, const QcServerAddress &address, const QString &detail = {})
QString reasonFor(QcJoinFailure::Kind kind, const QString &host)

Detailed Description

The texts come from the translation (context "QcJoinFailure"), never from the kind's name; detail and steps keep Qt's English error texts for the log.

Member Type Documentation

enum class QcJoinFailure::Kind

The step of a join that failed.

ConstantValueDescription
QcJoinFailure::Kind::Other0anything else; reason says what
QcJoinFailure::Kind::LookupFailed1the server's name was not found
QcJoinFailure::Kind::LookupTimedOut2looking the server's name up took too long (slow or no name server)
QcJoinFailure::Kind::TimedOut3no address answered the connection in time
QcJoinFailure::Kind::Refused4nothing listens on the port (the address answered with a refusal)
QcJoinFailure::Kind::Unreachable5the network cannot reach the address (or its family, as IPv6 without IPv6)
QcJoinFailure::Kind::Blocked6the system does not allow the connection (firewall, permissions)
QcJoinFailure::Kind::NoAnswer7the connection stands, but the TLS handshake got no answer in time
QcJoinFailure::Kind::OtherVersion8the server hung up on the TLS handshake (a version without TLS)
QcJoinFailure::Kind::TlsFailed9the TLS handshake failed otherwise
QcJoinFailure::Kind::NoCertificate10the server showed no certificate
QcJoinFailure::Kind::Untrusted11the server's certificate is not trusted (pin changed or not checkable)
QcJoinFailure::Kind::ServerClosed12the server closed the connection while logging in, without a reason
QcJoinFailure::Kind::LoginRefused13the server refused the login with a reason (password, version, content)

enum class QcJoinFailure::Step

The step a socket error happened in.

ConstantValueDescription
QcJoinFailure::Step::Lookup0looking up the server's name
QcJoinFailure::Step::Connecting1making the TCP connection to one of its addresses
QcJoinFailure::Step::Handshake2the TCP connection stands, the TLS handshake runs

Member Function Documentation

QString QcJoinFailure::hint() const

Returns a short translated hint what to check; empty when the reason says it all.

[static] QcJoinFailure::Kind QcJoinFailure::kindOf(QAbstractSocket::SocketError error, QcJoinFailure::Step step)

Returns the kind of the socket error that happened in step; a timeout of the connector counts as QAbstractSocket::SocketTimeoutError.

QString QcJoinFailure::logText() const

Returns everything in one English line for the log: kind, address, addresses, steps.

[static] QcJoinFailure QcJoinFailure::of(QcJoinFailure::Kind kind, const QcServerAddress &address, const QString &detail = {})

Returns the failure of kind at address with its reasonFor() text, or detail where the kind has none.

[static] QString QcJoinFailure::reasonFor(QcJoinFailure::Kind kind, const QString &host)

Returns the translated reason for kind at host; empty for the kinds whose reason comes from elsewhere (Other, Untrusted, LoginRefused).

bool QcJoinFailure::triedOnlyIpv6() const

Returns whether connections were tried and every one went to an IPv6 address.

QString QcJoinFailure::triedText() const

Returns the translated line naming the address and the IP addresses tried ("Tried …"); empty without an address.

Member Variable Documentation

QcServerAddress QcJoinFailure::address

The address the player joined; empty host for failures before an address was known.

QString QcJoinFailure::detail

Qt's error text of the last error (English), for the log.

QcJoinFailure::Kind QcJoinFailure::kind

The step that failed.

QString QcJoinFailure::reason

What failed, translated, for the player.

QStringList QcJoinFailure::steps

What happened at each address tried (English), for the log.

QList<QHostAddress> QcJoinFailure::tried

The IP addresses a connection was tried to, in order (after the name lookup).