Last active
July 21, 2017 08:54
-
-
Save Marenz/d19d3ff3695c1f22a9a90394ca22e848 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Program terminated with signal SIGABRT, Aborted. | |
#0 0x00007f784906f067 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 | |
56 ../nptl/sysdeps/unix/sysv/linux/raise.c: Datei oder Verzeichnis nicht gefunden. | |
(gdb) bt | |
#0 0x00007f784906f067 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 | |
#1 0x00007f7849070448 in __GI_abort () at abort.c:89 | |
#2 0x00007f78493f507a in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1 | |
#3 0x00007f78493f5517 in _Unwind_Resume () from /lib/x86_64-linux-gnu/libgcc_s.so.1 | |
#4 0x0000000001894323 in TCPHandler.TCPHandler.newConnection() (this=0x7f784adb2340, conn=0x47db600) | |
at source/TCPHandler.d:176 | |
#5 0x0000000001b7dc76 in vibe.core.drivers.libevent2_tcp.ClientTask.execute() (this=...) | |
at ../../.dub/packages/vibe-d-0.7.30/vibe-d/source/vibe/core/drivers/libevent2_tcp.d:618 | |
#6 0x00000000018600c5 in vibe.core.core.__T16makeTaskFuncInfoTDFZvZ.makeTaskFuncInfo() (tfi=0x7f66b6b63e00) | |
at ../../.dub/packages/vibe-d-0.7.30/vibe-d/source/vibe/core/core.d-mixin-604:604 | |
#7 0x0000000001b0d17b in vibe.core.core.CoreTask.run() (this=0x7f66e88e5a00) | |
at ../../.dub/packages/vibe-d-0.7.30/vibe-d/source/vibe/core/core.d:1221 | |
#8 0x0000000001c16398 in core.thread.Fiber.run() () | |
#9 0x0000000001c160fb in fiber_entryPoint () | |
#10 0x0000000000000000 in ?? () | |
public void newConnection ( TCPConnection conn ) | |
{ | |
conn.keepAlive = true; | |
this.num_clients++; | |
import Managers; | |
managers.log.incr("master.users.connected", 1); | |
// Persistent context for the client | |
auto client_context = new TCPContext(conn.peerAddress); | |
stdout.writefln("New client: %s (now %s)", | |
cast(void*) client_context, this.num_clients); | |
try | |
{ | |
// Start reading in extra fiber | |
auto reader = runTask(&startReading, conn, client_context, Task.getThis); | |
scope(exit) | |
{ | |
this.num_clients--; | |
managers.log.incr("master.users.connected", -1); | |
auto usr = managers.user.get(client_context.playerid); | |
if (usr !is null) with (managers.log) | |
{ | |
import std.format; | |
incr(format("master.users.country.%s", usr.country), -1); | |
incr(format("master.users.region.%s", usr.region), -1); | |
} | |
stderr.writefln("Lost client: %s (now %s)", | |
cast(void*) client_context, this.num_clients); // source/TCPHandler.d:176 (frame 10) | |
} | |
scope(exit) reader.join(); | |
scope(exit) if(conn.connected) | |
conn.close(); | |
scope(exit) if (client_context.pipe.connected) | |
client_context.pipe.close(); | |
while ( conn.connected && reader.running && | |
client_context.pipe.connected ) | |
{ | |
if (client_context.pipe.waitForData(dur!"seconds"(1))) | |
conn.write(client_context.pipe, | |
client_context.pipe.peek().length); | |
import std.c.time; | |
// Disconnect if we didn't receive a ping within the timeout limit | |
if (time(null) - client_context.last_ping > PingTimeout) | |
{ | |
logger.infof("Received no ping within %s seconds. " ~ | |
"Closing connection.", | |
time(null) - client_context.last_ping); | |
client_context.pipe.close(); | |
} | |
} | |
} | |
catch ( Exception e ) {} | |
finally | |
{ | |
stderr.writefln("%s About to call notifyAll()", | |
cast(void*) client_context); | |
// Very important, must absolutely be run | |
client_context.notifyAll(); | |
stderr.writefln("%s Notified all!", cast(void*) client_context); | |
logger.infof("%s with IP %s disconnected (ctx %s)", | |
client_context.steamid, client_context.ip, cast(void*) | |
client_context); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment