Issue information

Issue ID
#3700
Status
Fixed
Severity
Low
Started
Hercules Elf Bot
Oct 31, 2009 16:17
Last Post
Hercules Elf Bot
Apr 4, 2012 8:52
Confirmation
N/A

Hercules Elf Bot - Oct 31, 2009 16:17

Originally posted by [b]theultramage[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=3700

I received info from Meyraw regarding the issue where you log in to the mapserver, and are left hanging without loading the surroundings or char data.

He said that the issue happens when the client manages to load the map and submits loadendack before the servers fully activate the session (before rgistry arrives, essentially). Recent changes (well, r12223/2 years ago) broke the server-activated loadendack logic. Here's an overview of the procedure:

C->S: wanttoconnection
S->C: wait | request auth from charserver
S->C: authok | request regs from charserver
C->S: loadendack

now, normally the server would execute this:
CODE
    if (!sd->state.active)
    {    //Character loading is not complete yet!
        //Let pc_reg_received reinvoke this when ready.
        sd->state.connect_new = 0;
        return;
    }
which would later allow executing this:
CODE
    if (sd->state.connect_new == 0 && sd->fd)
    {    //Character already loaded map! Gotta trigger LoadEndAck manually.
        sd->state.connect_new = 1;
        clif_parse_LoadEndAck(sd->fd, sd);
    }


However, due to how the clif_parse code is structured, the loadendack packet actually gets discarded, because the session is not active yet:
CODE
    if (packet_db[packet_ver][cmd].func)
    {
        if (sd && sd->bl.prev == NULL && packet_db[packet_ver][cmd].func != clif_parse_LoadEndAck)
    ; //Only valid packet when player is not on a map is the finish-loading packet.
        else
        if ((sd && sd->status.active)
            || packet_db[packet_ver][cmd].func == clif_parse_WantToConnection
            || packet_db[packet_ver][cmd].func == clif_parse_debug
        )   //Only execute the function when there's an sd (except for debug/wanttoconnect packets)
            packet_db[packet_ver][cmd].func(fd, sd);
    }

This worked before r12223, because the 'active' constraint wasn't there yet.

As a consequence of having the loadendack packet discarded, the code that would set 'sd->state.connect_new' to the necessary value won't run, and therefore, the serverside loadendack won't execute, and the client will be left hanging.

PS: another bugreport that's sort of related: #573.

This post has been edited by theultramage: Oct 31 2009, 09:22 AM

Hercules Elf Bot - Dec 9, 2011 5:31

Originally posted by [b]Ind[/b]
has been fixed in a past revision