Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: [Network] On join, log the ClientID + IP + Name clearly #9558

Merged
merged 1 commit into from Sep 19, 2021

Conversation

TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Sep 18, 2021

Closes #9105.

Motivation / Problem

#9105 asks for better ability to match clientid + ip + username. Currently there isn't a single place this is logged, so tools etc can't pick up on this without difficult complexity on their side.

Description

Where #9105 presents some of this information via chat, of which I am not a fan (See #9105 (comment) for details), instead this PR presents the log in a single message.

Another difference to #9105 has to do with how loud we want connects to be. With this PR, this is what a normal connect looks like:

[2021-09-18 12:04:53] dbg: [net] [server] Client connected from 172.31.242.231 on frame 243
[2021-09-18 12:04:53] dbg: [net] [server] Client #2 closed connection
[2021-09-18 12:04:54] dbg: [net] [server] Client connected from 172.31.242.231 on frame 282
[2021-09-18 12:04:55] ‎*** TrueBrain #1 has joined the game (Client #3)
[2021-09-18 12:04:55] dbg: [net] [server] Client #3 (172.31.242.231) joined as TrueBrain #1

The first 2 lines are the server being queried by the client. The last 3 lines is a client joining (and has not left yet).

I went for only logging the "joined" when the name was known, so there is a single log message stating the client ID, the client IP and the client name. #9105 also adds a log message when the connection is assigned to a client ID, adding another message for only stating client ID + client IP. I can see the use of that, but it also makes the logs even more verbose. I am fully open to be convinced that is a good idea however :)

I also changed the "closed connection" message, to make the connect, join, and close message look alike. This should make it easier on tooling to deal with this.

Limitations

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR touches english.txt or translations? Check the guidelines
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

Additionally, reword the disconnect to match connect / join messages.
@TrueBrain TrueBrain added this to the 12.0 milestone Sep 18, 2021
@LordAro LordAro merged commit d9f8ed7 into OpenTTD:master Sep 19, 2021
@TrueBrain TrueBrain deleted the berbe-logs branch October 31, 2021 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants