X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_netmaster.pas;h=95fbb5f5b1b7584717b34911043cd036fd7bfd4b;hb=a50544067b99f65e2b4882366521287607dd892f;hp=393c4e572fc5191271ce324832860541376bfb79;hpb=3ef8e8c536c444b9e8a0adf38908d25082584e92;p=d2df-sdl.git diff --git a/src/game/g_netmaster.pas b/src/game/g_netmaster.pas index 393c4e5..95fbb5f 100644 --- a/src/game/g_netmaster.pas +++ b/src/game/g_netmaster.pas @@ -238,9 +238,12 @@ begin ct := GetTimerMS(); if (ct < stt) or (ct-stt >= 1500) then break; + // fuck! https://www.mail-archive.com/enet-discuss@cubik.org/msg00852.html + // tl;dr: on shitdows, we can get -1 sometimes, and it is *NOT* a failure. + // thank you, enet. let's ignore failures altogether then. sres := enet_host_service(NetMHost, @NetMEvent, 100); - if (sres < 0) then break; - if (sres = 0) then continue; + // if (sres < 0) then break; + if (sres <= 0) then continue; idx := findByPeer(NetMEvent.peer); if (idx < 0) then @@ -1107,7 +1110,7 @@ begin NetMHost := enet_host_create(nil, 64, NET_MCHANS, 1024*1024, 1024*1024); if (NetMHost = nil) then begin - g_Console_Add(_lc[I_NET_MSG_ERROR]+_lc[I_NET_ERR_CLIENT], True); + e_LogWriteln(_lc[I_NET_MSG_ERROR] + _lc[I_NET_ERR_CLIENT] + ' (host_create)', TMsgType.Notify); for f := 0 to High(mlist) do mlist[f].clear(); SetLength(mlist, 0); Exit; @@ -1145,12 +1148,15 @@ begin mlist[f].pulse(); end; + // fuck! https://www.mail-archive.com/enet-discuss@cubik.org/msg00852.html + // tl;dr: on shitdows, we can get -1 sometimes, and it is *NOT* a failure. + // thank you, enet. let's ignore failures altogether then. sres := enet_host_service(NetMHost, @NetMEvent, timeout); - while (sres <> 0) do + while (sres > 0) do begin if (sres < 0) then begin - g_Console_Add(_lc[I_NET_MSG_ERROR]+_lc[I_NET_ERR_CLIENT], True); + e_LogWriteln(_lc[I_NET_MSG_ERROR] + _lc[I_NET_ERR_CLIENT] + ' (host_service)', TMsgType.Notify); for f := 0 to High(mlist) do mlist[f].clear(); SetLength(mlist, 0); enet_host_destroy(NetMHost);