X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;ds=inline;f=src%2Fcore%2Fcore.cpp;h=46a0d6c0a23919bdce1f8e4bc1065e874a7adad4;hb=fe654bfe2e86149b18de76111ddb38985d505dd3;hp=08d4c07e694555f91103f78b53605332c78485f1;hpb=8f2a90212f31c3f8e1301fe28dfeb6ccfc753b23;p=quassel.git diff --git a/src/core/core.cpp b/src/core/core.cpp index 08d4c07e..46a0d6c0 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -246,48 +246,64 @@ bool Core::startListening() { const QString listen = Quassel::optionValue("listen"); const QStringList listen_list = listen.split(",", QString::SkipEmptyParts); - if (listen_list.size() > 0) { - foreach (const QString listen_term, listen_list) { + if(listen_list.size() > 0) { + foreach (const QString listen_term, listen_list) { // TODO: handle multiple interfaces for same TCP version gracefully QHostAddress addr; - if (! addr.setAddress(listen_term)) { + if(!addr.setAddress(listen_term)) { qCritical() << qPrintable( - QString("Invalid listen address %1") + tr("Invalid listen address %1") .arg(listen_term) ); } else { - switch (addr.protocol()) { + switch(addr.protocol()) { case QAbstractSocket::IPv4Protocol: - if (_server.listen(addr, port)) { + if(_server.listen(addr, port)) { quInfo() << qPrintable( - QString("Listening for GUI clients on IPv4 %1 port %2 using protocol version %3") + tr("Listening for GUI clients on IPv4 %1 port %2 using protocol version %3") .arg(addr.toString()) .arg(_server.serverPort()) .arg(Quassel::buildInfo().protocolVersion) ); success = true; - } + } else + quWarning() << qPrintable( + tr("Could not open IPv4 interface %1:%2: %3") + .arg(addr.toString()) + .arg(port) + .arg(_server.errorString())); break; case QAbstractSocket::IPv6Protocol: - if (_v6server.listen(addr, port)) { + if(_v6server.listen(addr, port)) { quInfo() << qPrintable( - QString("Listening for GUI clients on IPv6 %1 port %2 using protocol version %3") + tr("Listening for GUI clients on IPv6 %1 port %2 using protocol version %3") .arg(addr.toString()) - .arg(_server.serverPort()) + .arg(_v6server.serverPort()) .arg(Quassel::buildInfo().protocolVersion) ); success = true; + } else { + // if v4 succeeded on Any, the port will be already in use - don't display the error then + // FIXME: handle this more sanely, make sure we can listen to both v4 and v6 by default! + if(!success || _v6server.serverError() != QAbstractSocket::AddressInUseError) + quWarning() << qPrintable( + tr("Could not open IPv6 interface %1:%2: %3") + .arg(addr.toString()) + .arg(port) + .arg(_v6server.errorString())); } break; default: qCritical() << qPrintable( - QString("Invalid listen address %1, unknown network protocol") - .arg(listen_term) + tr("Invalid listen address %1, unknown network protocol") + .arg(listen_term) ); break; } } } } + if(!success) + quError() << qPrintable(tr("Could not open any network interfaces to listen on!")); return success; } @@ -380,7 +396,7 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) { #ifdef HAVE_SSL SslServer *sslServer = qobject_cast(&_server); QSslSocket *sslSocket = qobject_cast(socket); - bool supportSsl = (bool)sslServer && (bool)sslSocket && sslServer->certIsValid(); + bool supportSsl = (bool)sslServer && (bool)sslSocket && sslServer->isCertValid(); #else bool supportSsl = false; #endif