allow selection of listen address
This commit is contained in:
parent
8c6385048e
commit
0a29665927
@ -329,12 +329,13 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
|
|||||||
args.append(incoming_args[1].toString());
|
args.append(incoming_args[1].toString());
|
||||||
|
|
||||||
// char name
|
// char name
|
||||||
if (!server->characters.contains(incoming_args[2].toString()))
|
|
||||||
return invalid;
|
|
||||||
if (current_char != incoming_args[2].toString()) {
|
if (current_char != incoming_args[2].toString()) {
|
||||||
// Selected char is different from supplied folder name
|
// Selected char is different from supplied folder name
|
||||||
// This means the user is INI-swapped
|
// This means the user is INI-swapped
|
||||||
// TODO: ini swap locking
|
// TODO: ini swap locking
|
||||||
|
// if no iniswap allowed then
|
||||||
|
// if (!server->characters.contains(incoming_args[2].toString()))
|
||||||
|
// return invalid;
|
||||||
qDebug() << "INI swap detected from " << getIpid();
|
qDebug() << "INI swap detected from " << getIpid();
|
||||||
}
|
}
|
||||||
args.append(incoming_args[2].toString());
|
args.append(incoming_args[2].toString());
|
||||||
|
@ -32,7 +32,18 @@ Server::Server(int p_port, int p_ws_port, QObject* parent) : QObject(parent)
|
|||||||
|
|
||||||
void Server::start()
|
void Server::start()
|
||||||
{
|
{
|
||||||
if (!server->listen(QHostAddress::Any, port)) {
|
QSettings config("config/config.ini", QSettings::IniFormat);
|
||||||
|
config.beginGroup("Options");
|
||||||
|
QString bind_ip = config.value("ip", "all").toString();
|
||||||
|
QHostAddress bind_addr;
|
||||||
|
if (bind_ip == "all")
|
||||||
|
bind_addr = QHostAddress::Any;
|
||||||
|
else
|
||||||
|
bind_addr = QHostAddress(bind_ip);
|
||||||
|
if (bind_addr.protocol() != QAbstractSocket::IPv4Protocol && bind_addr.protocol() != QAbstractSocket::IPv6Protocol && bind_addr != QHostAddress::Any) {
|
||||||
|
qDebug() << bind_ip << "is an invalid IP address to listen on! Server not starting, check your config.";
|
||||||
|
}
|
||||||
|
if (!server->listen(bind_addr, port)) {
|
||||||
qDebug() << "Server error:" << server->errorString();
|
qDebug() << "Server error:" << server->errorString();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user