fix enable_ipv6=0

This commit is contained in:
proller 2016-11-13 14:37:25 +03:00
parent b3c0e08197
commit c843504f17
2 changed files with 9 additions and 2 deletions

View File

@ -715,11 +715,17 @@ void ServerEnvironment::saveLoadedPlayers()
{
auto lock = m_players.lock_unique_rec();
auto it = m_players.begin();
errorstream<< "ServerEnvironment::saveLoadedPlayers() \n";
while (it != m_players.end()) {
auto *player = *it;
//if (player->checkModified())
errorstream << "save id=" << player->peer_id << "refs="<< player->refs << " SAO="<<player->getPlayerSAO()<< "\n";
savePlayer(player);
if(!player->peer_id && !player->getPlayerSAO() && player->refs <= 0) {
Json::Value t;
t << *player;
errorstream << "remove player = " << player->peer_id << " j="<< t<<"\n";
delete player;
it = m_players.erase(it);
} else {
@ -742,6 +748,7 @@ void ServerEnvironment::saveLoadedPlayers()
void ServerEnvironment::savePlayer(RemotePlayer *player)
{
errorstream<<"ServerEnvironment::savePlayer " << player << "SAO=" << player->getPlayerSAO() << "\n";
if (!player || !player->getPlayerSAO())
return;
Json::Value player_json;

View File

@ -2235,7 +2235,7 @@ bool Game::createSingleplayerServer(const std::string map_dir,
std::string bind_str = g_settings->get("bind_address");
Address bind_addr(0, 0, 0, 0, port);
if (g_settings->getBool("ipv6_server")) {
if (g_settings->getBool("ipv6_server") && g_settings->getBool("enable_ipv6")) {
bind_addr.setAddress(in6addr_any);
}
@ -2477,7 +2477,7 @@ bool Game::connectToServer(const std::string &playername,
if (connect_address.isZero()) { // i.e. INADDR_ANY, IN6ADDR_ANY
//connect_address.Resolve("localhost");
if (connect_address.isIPv6() || g_settings->getBool("ipv6_server")) {
if (connect_address.isIPv6() || (g_settings->getBool("ipv6_server") && g_settings->getBool("enable_ipv6"))) {
connect_address.setAddress(in6addr_loopback);
} else {
connect_address.setAddress(127, 0, 0, 1);