Open rumichi2210 opened 3 months ago
Could you provide a minimal reproducer of the problem for us to look at? Is it unmodified example/main.cpp from this repo?
I only changed the ipAddress in example/main.cpp.
#include <nakama-cpp/Nakama.h>
#include "nakama-cpp/realtime/NRtDefaultClientListener.h"
#include <iostream>
#include <chrono>
#include <thread>
#include <optional>
int mainHelper();
int main() {
return mainHelper();
}
int mainHelper() {
Nakama::NLogger::initWithConsoleSink(Nakama::NLogLevel::Debug);
Nakama::NClientParameters params;
params.serverKey = "defaultkey";
params.host = "192.168.200.100";
params.port = Nakama::DEFAULT_PORT;
auto client = Nakama::createDefaultClient(params);
Nakama::NRtClientPtr rtClient = nullptr;
bool done = false;
auto loginFailedCallback = [&done](const Nakama::NError &error) {
NLOG_INFO("Failed to login");
NLOG_INFO(error.message);
done = true;
};
auto connectSucceededCallback = [&done]() {
NLOG_INFO("Done connecting socket");
done = true;
};
auto rtErrorCallback = [&done](const Nakama::NRtError& error) {
NLOG_INFO("Error from socket:...");
NLOG_INFO(error.message);
done = true;
};
auto loginSucceededCallback = [&done, &connectSucceededCallback, &rtErrorCallback, &client, &rtClient](Nakama::NSessionPtr session) {
NLOG_INFO("Login successful");
NLOG_INFO(session->getAuthToken()); // raw JWT token
Nakama::NRtDefaultClientListener listener;
listener.setConnectCallback(connectSucceededCallback);
listener.setErrorCallback(rtErrorCallback);
rtClient = client->createRtClient();
rtClient->setListener(&listener);
NLOG_INFO("Connecting socket");
rtClient->connect(session, true, Nakama::NRtClientProtocol::Json);
};
std::string deviceId = "e872f976-34c1-4c41-88fe-fd6aef118782";
NLOG_INFO("Authenticating...");
client->authenticateDevice(
deviceId,
Nakama::opt::nullopt,
Nakama::opt::nullopt,
{},
loginSucceededCallback,
loginFailedCallback);
while (!done) {
client->tick();
if (rtClient)
{
rtClient->tick();
}
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
NLOG_INFO("Press any key to continue");
getchar();
client->disconnect();
return 0;
}
I am experiencing the same issue.
Nakama Server version 3.22.0+4a4c53d7
nakama cpp version: [v2.8.5]
When I run nakama-cpp/example/main.cpp in a windows environment
different parts crash in both releasebuild and debugbuild.
In releasebuild
auto client = Nakama::createDefaultClient(params);
an exception is raised at runtime, and
In debug build
rtClient->tick() crashes on the third call.
Similar issues encountered in the past
C++ SDK crashes on createDefaultClient - Heroic Labs
I tried v2.7.0 and the situation did not change.
Log in debug build: --------------------------------------------------------
Server side log: -----------------------------------------------------------------------------