Skip to content
Permalink
Browse files

10s timeout when connecting to server

  • Loading branch information
SmallJoker authored and est31 committed Apr 17, 2015
1 parent d4d561f commit 5f0b36b8b70faa36b20343342567471c8f50b7f2
Showing with 13 additions and 2 deletions.
  1. +13 −2 src/game.cpp
@@ -2181,7 +2181,10 @@ bool Game::connectToServer(const std::string &playername,
input->clear();

FpsControl fps_control = { 0 };
f32 dtime; // in seconds
f32 dtime;
f32 wait_time = 0; // in seconds

fps_control.last_time = device->getTimer()->getTime();

while (device->run()) {

@@ -2213,6 +2216,13 @@ bool Game::connectToServer(const std::string &playername,
break;
}

wait_time += dtime;
if (wait_time > 10) {
*error_message = "Connection timed out.";
errorstream << *error_message << std::endl;
break;
}

// Update status
showOverlayMessage(wgettext("Connecting to server..."), dtime, 20);
}
@@ -2232,6 +2242,8 @@ bool Game::getServerContent(bool *aborted)
FpsControl fps_control = { 0 };
f32 dtime; // in seconds

fps_control.last_time = device->getTimer()->getTime();

while (device->run()) {

limitFps(&fps_control, &dtime);
@@ -4137,7 +4149,6 @@ inline void Game::limitFps(FpsControl *fps_timings, f32 *dtime)
// not using getRealTime is necessary for wine
device->getTimer()->tick(); // Maker sure device time is up-to-date
u32 time = device->getTimer()->getTime();

u32 last_time = fps_timings->last_time;

if (time > last_time) // Make sure time hasn't overflowed

10 comments on commit 5f0b36b

@HybridDog

This comment has been minimized.

Copy link
Contributor

@HybridDog HybridDog replied Apr 19, 2015

l wanted to play minetest in singleplayer mode but l got the connection timed out message.
l use many mods:

ac, ambience, antiguest, as_transport, asphalt, asphaltstairs, beds, boats, bobblocks, bones, bookmarks, bucket, builtin_item, bushes_classic, caca, cannons, carts, chain_transfer, clams, clean, command_tool, compressed_cobble, computer, concrete, concretestairs, conifers, connected_chests, connected_textures, constructionarea, creative, crops, darkage, default, delineator, diamonds, digilines, digilines_inventory, digilines_lcd, digilines_lightsensor, digilines_rtc, dogblocks, doors, dye, emergencyphone, eridium, explore_map, extinguisher, extrablocks, extranodes, fancy_elevator, farming, farming_plus, fire, firearms, fireworks, flowers, flowers_plus, fraktaltest, function_delayer, give_initial_stuff, glow, gosirea, grass, greenscreens, gt1111, habitat, hand, heads, hnoise, home_builder, hydro, influencia, intllib, inventory_plus, item_drop, itemframes, jdc_lamps, jdukebox, jukebox, jungletree, labels, lantern, laser, lavacooling, locked_sign, ltool, luacmd, lunit, manholes, mapp, maze, mese_fence, mesecar, mesecons, mesecons_alias, mesecons_blinkyplant, mesecons_button, mesecons_commandblock, mesecons_delayer, mesecons_detector, mesecons_doors, mesecons_extrawires, mesecons_gates, mesecons_hydroturbine, mesecons_insulated, mesecons_lamp, mesecons_lightstone, mesecons_luacontroller, mesecons_materials, mesecons_microcontroller, mesecons_movestones, mesecons_mvps, mesecons_noteblock, mesecons_pistons, mesecons_powerplant, mesecons_pressureplates, mesecons_random, mesecons_receiver, mesecons_solarpanel, mesecons_stickyblocks, mesecons_switch, mesecons_teleporter, mesecons_torch, mesecons_walllever, mgtest, mining_plus, misstairs, mo, modmenu, money, more_chests, moreblocks, morecobblenodes, morefences, moreladders, moreores, moretechnictools, moretrees, moss, mudbrick, multitest, music, my_castle_doors, my_door_wood, my_fancy_doors, my_hidden_doors, my_misc_doors, mydeck, nether, noairblocks, nodebox_creator, nuke, nyanland, outgame_intervention, painting, panola, pathogen, pathv6alt, pipeworks, plants_lib, plasmalamp, poisonivy, portal, potions, projects, quartz, quests, radio, realclocks, replacer, riesenpilz, roadsigns, roadworks, rotten_papyrus, ruins, rulesaccept, screwdriver, seacobble, seaglass, seagravel, sealamps, seaplants, seastone, seastonebrick, seawrecks, sethome, shadows, shears, shooter, simple_machines, simple_robots, skins, small_paths, snow, special, special_picks, stairs, stairsshine, stay_inside, steel, steelsupport, streetlamps, streetsawards, streetsconcrete, streetshotfix, streetsmod, streetspoles, sumpf, superpick, tbm, technic, technic_chests, technic_extras, technic_worldgen, teleporters, tetris, titanium, tnt, trafficlight, trash_can, trashcan, travelnet, treecapitator, ufos, unified_inventory, urban, usesdirt, vector_extras, vessels, vines, vulkane, weather, weirdores, whiteshell, wool, workers, worldedit, worldedit_commands, worldedit_extras, worldedit_gui, worldedit_infinity, worldedit_limited, worldedit_shortcommands, wrench, wz2100, xpanes and zcg

@est31

This comment has been minimized.

Copy link
Contributor

@est31 est31 replied Apr 19, 2015

perhaps this should be disabled for singleplayer.

@nerzhul

This comment has been minimized.

Copy link
Member

@nerzhul nerzhul replied Apr 19, 2015

We have playername here. We can compare it to disable the timeout. Can you provide this patch @est31, i'm absent today.

@ShadowNinja

This comment has been minimized.

Copy link
Member

@ShadowNinja ShadowNinja replied Apr 22, 2015

@nerzhul: Or use is_local_server or equivalent...

@est31

This comment has been minimized.

Copy link
Contributor

@est31 est31 replied Apr 22, 2015

Already fixed in f1a41e4 using the same check as Game::init does for actually creating a server.

@C1ffisme

This comment has been minimized.

Copy link

@C1ffisme C1ffisme replied Apr 22, 2015

@HybridDog

You have a mod called wz2100?

Warzone 2100?

Anyway, yeah. Good for fixing this. Sorry for butting my head in, but I had to give my 2 cents.

You use a lot of mods, HybridDog.

@HybridDog

This comment has been minimized.

Copy link
Contributor

@HybridDog HybridDog replied Apr 22, 2015

You have a mod called wz2100?

Warzone 2100?

Yes, it currently only adds a nexus link item (with the sounds) which can be used to steal others chests.
l thought about adding working tanks, trucks and towers but l lost interest.

You use a lot of mods, HybridDog.

yes, l know almost every one of them

@C1ffisme

This comment has been minimized.

Copy link

@C1ffisme C1ffisme replied Apr 23, 2015

Ah.

Sorry about the un-related comment. I just saw it and HAD to speak up.

Maybe you should start your mod up again. You can make some kind of turret for towers, trucks can use specified schematics, and tanks can be 3 entities (Body, weapon and transport)

@HybridDog

This comment has been minimized.

Copy link
Contributor

@HybridDog HybridDog replied Apr 23, 2015

but entities are so laggy

@C1ffisme

This comment has been minimized.

Copy link

@C1ffisme C1ffisme replied Apr 23, 2015

Yeah. True.

Okay, before we annoy everybody with this conversation, why not post the mod up on github and make an issue for this discussion. I can imagine everybody is seeing our smalltalk conversation.

Sorry other github users.

Please sign in to comment.