draconisPW / PWMAngband

A free, multi-player roguelike dungeon exploration game based on Angband
35 stars 12 forks source link

Could not accept TCP Connection, socket error = 0 #560

Closed igroglaz closed 2 years ago

igroglaz commented 2 years ago

After I've added in T account_score system after each death when there are several players online I see in the logs hundreds (or thousands) lines in the code likes this:

290622 194631 Nimly: You have been killed by Grip, Farmer Maggot's Dog.
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
.................
..................................ANOTHER 4000 lines like this..................................
.................
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194631 Could not accept TCP Connection, socket error = 0
290622 194632 Goodbye Nimly=MyPC@com ("Killed by Grip, Farmer Maggot's Dog")
290622 194632 Azken Zutik: The blackguard hits you (10).
290622 194632 Azken Zutik: The blackguard misses you.
290622 194632 Azken Zutik: The blackguard misses you.
290622 194632 Azken Zutik: The Bolt of Haleglar (3d5) (+0,+0) {@f0} misses the blackguard.
290622 194632 Azken Zutik: The Bolt of Haleglar (3d5) (+0,+0) {@f0} misses the blackguard.
290622 194632 Azken Zutik: The crypt thing commands you to go away.
290622 194632 Azken Zutik: The vampire bat wakes up.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194633 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194634 Azken Zutik: No available target.
290622 194635 Azken Zutik: No available target.
290622 194635 Azken Zutik: No available target.
290622 194635 Azken Zutik: No available target.
290622 194637 Azken Zutik: You have 37 Potions of Cure Serious Wounds (n).
290622 194637 Azken Zutik: No available target.
290622 194637 Azken Zutik: No available target.
290622 194637 Azken Zutik: No available target.

At first when I've implemented account_score in simple way - I had such output (a lot of Could not accept TCP Connection, socket error = 0) even when there wasn't players online... So I've added file_lock(lok); (https://github.com/igroglaz/Tangaria/commit/53abcc3732140d4b501436817ad5b79b5d7d0f03) to account_score and it become much better... but still if there are players on server and they make a lot of action such 'spam' appears.

AFAIU this is pure cosmetic problem, but still will be fun to fix it. I wonder, maybe we can add something like

/* Hack -- repeated message of the same type /
    if (dup && (type == p->msg_last_type))
    {
        / Send a SPACE character instead */
        Send_message(p, " ", type);
        return;
    }

to prevent a lot of similar messages in the log? Or maybe there is some other way to improve it?

Also rarely such messages appears in other cases, eg:

290622 044815 Fokgrog: [Fokgrog] hi
290622 044818 Could not accept TCP Connection, socket error = 0
290622 044819 Azken Zutik: You have found 96 gold pieces worth of copper.
290622 044825 Azken Zutik: There is a wall in the way!
290622 044825 Azken Zutik: There is a wall in the way!
290622 044825 Azken Zutik: There is a wall in the way!
290622 044827 Azken Zutik: There is a wall in the way!
290622 044827 Azken Zutik: There is a wall in the way!
290622 044828 Could not accept TCP Connection, socket error = 0
290622 044828 Azken Zutik: There is a wall in the way!

...but not in such quantities like after player RIP :)

draconisPW commented 2 years ago

Fixing this "Could not accept TCP Connection, socket error = 0" problem has been in the backlog forever (got the line in my roadmap file for like 5 years), but I've never been able to track down the cause. Looking at my code in Contact(), I've noted that this probably only happens when the server is run in debug mode, which is the case for T. Since errno = 0 makes no sense, I'll simply remove the message.