From ee184a558ca7dca44dd23abadf3e69b0a08230f2 Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Sat, 9 Aug 2014 22:07:32 +0200 Subject: [PATCH] Fallback to IPv4 if IPv6 fails Fixes #181 --- core.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/core.cpp b/core.cpp index 920c28218..b54b18783 100644 --- a/core.cpp +++ b/core.cpp @@ -97,9 +97,22 @@ void Core::start() tox = tox_new(enableIPv6); if (tox == nullptr) { - qCritical() << "Tox core failed to start"; - emit failedToStart(); - return; + if (enableIPv6) // Fallback to IPv4 + { + tox = tox_new(false); + if (tox == nullptr) + { + qCritical() << "Tox core failed to start"; + emit failedToStart(); + return; + } + } + else + { + qCritical() << "Tox core failed to start"; + emit failedToStart(); + return; + } } toxav = toxav_new(tox, TOXAV_MAX_CALLS);