]> git.pond.sub.org Git - empserver/commit
Journal login before changing the player thread's name
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 29 Apr 2012 10:36:54 +0000 (12:36 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 1 May 2012 16:37:49 +0000 (18:37 +0200)
commit5729c1845818de7803ea9d3d648a1bba8a80e35f
tree7a26dc21783d34cece1abb71fab5fd63f5ec0b40
parenteed7a46aeddac874190afc76c9831247ce3db007
Journal login before changing the player thread's name

The journal logs a thread name for each event.  The player thread name
changes on entry to the playing phase.  Connecting old and new name
isn't as easy as it should be:

    Sun Apr 29 12:13:39 2012     Conn29 input coun POGO
    Sun Apr 29 12:13:39 2012     Conn29 input pass peter
    Sun Apr 29 12:13:39 2012     Conn29 input play
    Sun Apr 29 12:13:39 2012     Play#0 login 0 127.0.0.1 armbru
    Sun Apr 29 12:15:39 2012     Play#0 logout 0

To connect Conn29 with Play#0, you have to know that country#0 is
named POGO.

Fix that by logging login before the thread name change:

    Sun Apr 29 12:17:41 2012     Conn29 input coun POGO
    Sun Apr 29 12:17:41 2012     Conn29 input pass peter
    Sun Apr 29 12:17:41 2012     Conn29 input play
    Sun Apr 29 12:17:41 2012     Conn29 login 0 127.0.0.1 armbru
    Sun Apr 29 12:19:41 2012     Play#0 logout 0

Now "Conn29 login 0" makes the connection obvious.

This involves moving journal_login() from player_main() before
empth_set_name() in its caller play_cmd().  Move journal_logout() as
well, for symmetry.

If player_main() fails, we now log login/logout instead of nothing in
the journal.  That's okay.  Note that before commit c9f21c0e (v4.3.8),
we logged just login then.
src/lib/player/login.c
src/lib/player/player.c