Skip to content

Commit

Permalink
feat(skymp5-server): log guid on connection in ServerState (#2346)
Browse files Browse the repository at this point in the history
  • Loading branch information
nic11 authored Feb 17, 2025
1 parent b66c0bf commit 247fc71
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
18 changes: 14 additions & 4 deletions skymp5-server/cpp/server_guest_lib/ServerState.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
#include "ServerState.h"
#include "Exceptions.h"
#include "JsonUtils.h"
#include "MpActor.h"
#include "MsgType.h"

#include <algorithm>

#include <spdlog/spdlog.h>

#include "MpActor.h"

void ServerState::Connect(Networking::UserId userId, const std::string& guid)
{
if (userInfo[userId] != nullptr) {
spdlog::error("ServerState::Connect: overwritten userInfo for userId={}, "
"old guid: {}, new guid: {}",
userId, userInfo[userId]->guid, guid);
}

userInfo[userId] = std::make_unique<UserInfo>();
userInfo[userId]->guid = guid;

spdlog::info("ServerState::Connect: assigning guid for userId={}: guid={}",
userId, guid);

if (maxConnectedId < userId) {
maxConnectedId = userId;
}
Expand Down
3 changes: 2 additions & 1 deletion skymp5-server/ts/systems/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ export class Login implements System {
if (type !== "loginWithSkympIo") return;

const ip = ctx.svr.getUserIp(userId);
console.log(`Connecting a user ${userId} with ip ${ip}`);
const guid = ctx.svr.getUserGuid(userId);
console.log(`Connecting a user ${userId} with ip ${ip}, guid ${guid}`);

let discordAuth = this.settingsObject.discordAuth;

Expand Down

0 comments on commit 247fc71

Please sign in to comment.