From 686c028b3833ba2d9b68b1b2b5a167e96ba3b47f Mon Sep 17 00:00:00 2001 From: lotodore Date: Mon, 4 Jun 2007 17:04:03 +0000 Subject: [PATCH] Server errors are now shown. --- src/gui/qt/guiwrapper.cpp | 2 +- src/gui/qt/mainwindow/mainwindowimpl.cpp | 1 + src/gui/qt/mainwindow/mainwindowimpl.h | 1 + src/net/common/serverthread.cpp | 4 ++-- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/qt/guiwrapper.cpp b/src/gui/qt/guiwrapper.cpp index 0f3e3a31..cc692d8c 100644 --- a/src/gui/qt/guiwrapper.cpp +++ b/src/gui/qt/guiwrapper.cpp @@ -104,7 +104,7 @@ void GuiWrapper::SignalNetClientGameStart(boost::shared_ptr game) { myW->s void GuiWrapper::SignalNetClientChatMsg(const string &playerName, const string &msg) { myChat->signalChatMessage(QString::fromUtf8(playerName.c_str()), QString::fromUtf8(msg.c_str())); } void GuiWrapper::SignalNetServerSuccess(int actionID) { } -void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { } +void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { myW->signalNetServerError(errorID, osErrorID); } void GuiWrapper::SignalNetServerPlayerJoined(const string &playerName) { myW->signalNetServerPlayerJoined(QString::fromUtf8(playerName.c_str())); } void GuiWrapper::SignalNetServerPlayerLeft(const string &playerName) { myW->signalNetServerPlayerLeft(QString::fromUtf8(playerName.c_str())); } diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index 1b58433d..65001bbb 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -615,6 +615,7 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent) // Errors are handled globally, not within one dialog. connect(this, SIGNAL(signalNetClientError(int, int)), this, SLOT(networkError(int, int))); + connect(this, SIGNAL(signalNetServerError(int, int)), this, SLOT(networkError(int, int))); connect(this, SIGNAL(signalNetClientGameStart(boost::shared_ptr)), this, SLOT(networkStart(boost::shared_ptr))); connect(this, SIGNAL(signalNetServerPlayerJoined(QString)), myStartNetworkGameDialog, SLOT(addConnectedPlayer(QString))); diff --git a/src/gui/qt/mainwindow/mainwindowimpl.h b/src/gui/qt/mainwindow/mainwindowimpl.h index a83d1e2d..7b2e1132 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.h +++ b/src/gui/qt/mainwindow/mainwindowimpl.h @@ -113,6 +113,7 @@ signals: void signalNetClientConnect(int actionID); void signalNetClientGameInfo(int actionID); void signalNetClientError(int errorID, int osErrorID); + void signalNetServerError(int errorID, int osErrorID); void signalNetClientPlayerJoined(QString playerName); void signalNetClientPlayerLeft(QString playerName); void signalNetClientGameStart(boost::shared_ptr game); diff --git a/src/net/common/serverthread.cpp b/src/net/common/serverthread.cpp index e400a352..b6db9a8a 100644 --- a/src/net/common/serverthread.cpp +++ b/src/net/common/serverthread.cpp @@ -104,8 +104,8 @@ ServerThread::Listen() { ServerContext &context = GetContext(); -// if (context.GetServerPort() < 1024) -// throw ServerException(ERR_SOCK_INVALID_PORT, 0); + if (context.GetServerPort() < 1024) + throw ServerException(ERR_SOCK_INVALID_PORT, 0); context.SetSocket(socket(context.GetAddrFamily(), SOCK_STREAM, context.GetProtocol())); if (!IS_VALID_SOCKET(context.GetSocket()))