This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
photonclient.cpp
561 lines (480 loc) · 20.6 KB
/
photonclient.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
#include "photonclient.h"
#include <thread>
#include "fmt/core.h"
#include "fmt/xchar.h"
std::string_view VRCHAT_APPID = "bf0942f7-9935-4192-b359-f092fa85bef1";
std::string_view PHOTON_MAIN_NS = "62.169.222.103:5058";
namespace PhotonLB = ExitGames::LoadBalancing;
inline std::string_view utf8_encode(const ExitGames::Common::JString& wstr)
{
auto utf8 = wstr.UTF8Representation();
return std::string_view(utf8.cstr(), utf8.size());
}
inline std::string utf8_encode_copy(const ExitGames::Common::JString& wstr)
{
return std::string(utf8_encode(wstr));
}
inline ExitGames::Common::JString utf8_decode(const std::string& str)
{
return ExitGames::Common::JString(str.data());
}
template <typename T>
inline T DecodeJType(const ExitGames::Common::Object* object) {
return ExitGames::Common::ValueObject<T>(object).getDataAddress();
}
template <typename T>
inline std::optional<T> DecodeObject(const ExitGames::Common::Object* object) {
if (object != nullptr) {
if constexpr (std::is_same<T, ExitGames::Common::JString>::value) {
return ExitGames::Common::ValueObject<ExitGames::Common::JString>(object).getDataCopy();
}
else if constexpr (std::is_same<T, std::string>::value) {
ExitGames::Common::ValueObject<ExitGames::Common::JString> valueObj(object);
return utf8_encode_copy(*valueObj.getDataAddress());
}
}
return std::nullopt;
}
VRChad::PhotonClient::PhotonClient(std::string_view vrchatClientVersion, std::string_view userId, std::string_view authToken, std::string_view hwid)
: PhotonLB::Client(*this, VRCHAT_APPID.data(), vrchatClientVersion.data(), ExitGames::Photon::ConnectionProtocol::UDP, false, PhotonLB::RegionSelectionMode::SELECT, false)
, PhotonLB::Listener()
, m_photonThread()
, m_authValues()
, m_regions()
, m_userId(userId)
, m_authToken(authToken)
, m_hwid(hwid)
, m_authParamsStr()
, m_cloudRegion()
, m_photonSecret()
, m_disconnectIntention(DisconnectIntention::Unknown)
, m_connectionState(ConnectionState::Disconnected)
{
fmt::print("[Photon] Starting photon thread...\n");
m_photonThread = std::thread(&VRChad::PhotonClient::photonLoop, this);
fmt::print("[Photon] Setting up connection options...\n");
ExitGames::LoadBalancing::ConnectOptions connectOptions;
connectOptions.setAuthenticationValues(m_authValues);
connectOptions.setServerAddress(PHOTON_MAIN_NS.data());
connectOptions.setServerType(PhotonLB::ServerType::NAME_SERVER);
m_authParamsStr = fmt::format("token={}&user={}&hwid={}&platform=android", m_authToken, m_userId, m_hwid);
m_authValues.setType(PhotonLB::CustomAuthenticationType::CUSTOM);
m_authValues.setParameters(m_authParamsStr.c_str());
connectOptions.setAuthenticationValues(m_authValues);
connect(connectOptions);
SetConnectionState(ConnectionState::ConnectingToNameServer);
}
VRChad::PhotonClient::~PhotonClient()
{
fmt::print("VRChad::VrcPhotonClient::~VrcPhotonClient()\n");
}
bool VRChad::PhotonClient::leaveRoom()
{
return opLeaveRoom(false);
}
void VRChad::PhotonClient::photonLoop()
{
while (true) {
service();
std::this_thread::sleep_for(std::chrono::milliseconds(50));
fflush(stdout);
}
}
void VRChad::PhotonClient::connectToRegionMaster() {
if (GetConnectionStateIsConnected()) {
SetDisconnectIntention(DisconnectIntention::ConnectToMasterServer);
SetConnectionStateAsDisconnecting();
disconnect();
} else {
SetConnectionState(ConnectionState::ConnectingToMasterServer);
std::string_view addr = m_regions[m_cloudRegion];
m_authParamsStr = fmt::format("token={}&user={}&hwid={}&platform=standalonewindows", m_authToken, m_userId, m_hwid);
fmt::print("[Photon] RegionMaster: {} BestPing: {}\n", utf8_encode(getMasterserverAddress()), utf8_encode(getRegionWithBestPing()));
fmt::print("[Photon] Connecting to {} with params: {}\n\n", addr, m_authParamsStr);
m_authValues.setType(PhotonLB::CustomAuthenticationType::CUSTOM);
m_authValues.setParameters(m_authParamsStr.c_str());
ExitGames::LoadBalancing::ConnectOptions connectOptions;
connectOptions.setAuthenticationValues(m_authValues);
connectOptions.setServerAddress(addr.data());
connectOptions.setServerType(PhotonLB::ServerType::MASTER_SERVER);
connect(connectOptions);
}
}
void VRChad::PhotonClient::onCustomAuthenticationIntermediateStep(const ExitGames::Common::Dictionary<ExitGames::Common::JString, ExitGames::Common::Object>& authValues)
{
}
void VRChad::PhotonClient::onStatusChanged(int statusCode)
{
Client::onStatusChanged(statusCode); // Call base
switch (statusCode) {
case ExitGames::Photon::StatusCode::EXCEPTION_ON_CONNECT:
fmt::print("[Photon] encountered an exception while opening the incoming connection to the server. The server could be down / not running\n");
break;
case ExitGames::Photon::StatusCode::CONNECT:
SetConnectionStateAsConnected();
break;
case ExitGames::Photon::StatusCode::EXCEPTION:
fmt::print("[Photon] encountered an exception and will disconnect, too\n");
break;
case ExitGames::Photon::StatusCode::QUEUE_OUTGOING_RELIABLE_WARNING:
fmt::print("[Photon] outgoing queue is filling up. send more often\n");
break;
case ExitGames::Photon::StatusCode::QUEUE_OUTGOING_UNRELIABLE_WARNING:
fmt::print("[Photon] outgoing queue is filling up. send more often\n");
break;
case ExitGames::Photon::StatusCode::SEND_ERROR:
fmt::print("[Photon] Sending command failed. Either not connected, or the requested channel is bigger than the number of initialized channels\n");
break;
case ExitGames::Photon::StatusCode::QUEUE_OUTGOING_ACKS_WARNING:
fmt::print("[Photon] outgoing queue is filling up. Send more often\n");
break;
case ExitGames::Photon::StatusCode::QUEUE_INCOMING_RELIABLE_WARNING:
fmt::print("[Photon] incoming reliable queue is filling up. Dispatch more often\n");
break;
case ExitGames::Photon::StatusCode::QUEUE_INCOMING_UNRELIABLE_WARNING:
fmt::print("[Photon] incoming unreliable queue is filling up. Dispatch more often\n");
break;
case ExitGames::Photon::StatusCode::QUEUE_SENT_WARNING:
fmt::print("[Photon] sent queue is filling up. Check, why the server does not acknowledge your sent reliable commands\n");
break;
case ExitGames::Photon::StatusCode::INTERNAL_RECEIVE_EXCEPTION:
fmt::print("[Photon] Exception, if a server cannot be connected. Most likely, the server is not responding. Ask the user to try again later\n");
break;
case ExitGames::Photon::StatusCode::TIMEOUT_DISCONNECT:
fmt::print("[Photon] Disconnection due to a timeout (client did no longer receive ACKs from server)\n");
SetConnectionState(ConnectionState::Disconnected);
break;
case ExitGames::Photon::StatusCode::DISCONNECT_BY_SERVER:
fmt::print("[Photon] Disconnect by server due to timeout (received a disconnect command, cause server misses ACKs of client)\n");
SetDisconnectIntention(DisconnectIntention::DisconnectedByServer);
SetConnectionState(ConnectionState::Disconnected);
break;
case ExitGames::Photon::StatusCode::DISCONNECT_BY_SERVER_LOGIC:
fmt::print("[Photon] Disconnect by server due to server's logic (received a disconnect command)\n");
SetDisconnectIntention(DisconnectIntention::DisconnectedByServerLogic);
SetConnectionState(ConnectionState::Disconnected);
break;
case ExitGames::Photon::StatusCode::DISCONNECT_BY_SERVER_USER_LIMIT:
fmt::print("[Photon] Disconnect by server due to concurrent user limit reached (received a disconnect command)\n");
SetDisconnectIntention(DisconnectIntention::DisconnectedByServerUserLimit);
SetConnectionState(ConnectionState::Disconnected);
break;
case ExitGames::Photon::StatusCode::ENCRYPTION_ESTABLISHED:
fmt::print("[Photon] Encryption success\n");
break;
case ExitGames::Photon::StatusCode::ENCRYPTION_FAILED_TO_ESTABLISH:
fmt::print("[Photon] Encryption failed, Check debug logs\n");
break;
default:
return;
}
}
void VRChad::PhotonClient::onEvent(const ExitGames::Photon::EventData& eventData)
{
Client::onEvent(eventData); // Call base
fmt::print("VRChad::VrcPhotonClient::onEvent() {}\n", eventData.getCode());
if (eventData.getCode() == 255) {
fmt::print("User joined!\n");
}
}
void VRChad::PhotonClient::onPingResponse(const ExitGames::Common::JString& address, unsigned int result)
{
Client::onPingResponse(address, result); // Call base
fmt::print("VRChad::VrcPhotonClient::onPingResponse() {} {}\n", utf8_encode(address), result);
}
void VRChad::PhotonClient::debugReturn(int debugLevel, const ExitGames::Common::JString& jstring)
{
fmt::print("VRChad::VrcPhotonClient::debugReturn() {} {}\n", debugLevel, utf8_encode(jstring));
}
void VRChad::PhotonClient::connectionErrorReturn(int errorCode)
{
fmt::print("VRChad::VrcPhotonClient::connectionErrorReturn() {}\n", errorCode);
}
void VRChad::PhotonClient::clientErrorReturn(int errorCode)
{
fmt::print("VRChad::VrcPhotonClient::clientErrorReturn() {}\n", errorCode);
}
void VRChad::PhotonClient::warningReturn(int warningCode)
{
fmt::print("VRChad::VrcPhotonClient::warningReturn() {}\n", warningCode);
}
void VRChad::PhotonClient::serverErrorReturn(int errorCode)
{
fmt::print("VRChad::VrcPhotonClient::serverErrorReturn() {}\n", errorCode);
}
void VRChad::PhotonClient::joinRoomEventAction(int playerNr, const ExitGames::Common::JVector<int>& playernrs, const PhotonLB::Player& player)
{
fmt::print("VRChad::VrcPhotonClient::joinRoomEventAction() {}\n", playerNr);
}
void VRChad::PhotonClient::leaveRoomEventAction(int playerNr, bool isInactive)
{
fmt::print("VRChad::VrcPhotonClient::leaveRoomEventAction() {}\n", playerNr);
}
void VRChad::PhotonClient::customEventAction(int playerNr, nByte eventCode, const ExitGames::Common::Object& eventContent)
{
fmt::print("VRChad::VrcPhotonClient::customEventAction() {}\n", playerNr);
}
void VRChad::PhotonClient::connectReturn(int errorCode, const ExitGames::Common::JString& errorString, const ExitGames::Common::JString& region, const ExitGames::Common::JString& cluster)
{
fmt::print("VRChad::VrcPhotonClient::connectReturn() {}\n", errorCode);
}
void VRChad::PhotonClient::disconnectReturn()
{
SetConnectionState(ConnectionState::Disconnected);
if (m_disconnectIntention == DisconnectIntention::ConnectToMasterServer) {
connectToRegionMaster();
}
}
void VRChad::PhotonClient::createRoomReturn(int, const ExitGames::Common::Hashtable&, const ExitGames::Common::Hashtable&, int, const ExitGames::Common::JString&)
{
fmt::print("VRChad::VrcPhotonClient::createRoomReturn()\n");
}
void VRChad::PhotonClient::joinOrCreateRoomReturn(int, const ExitGames::Common::Hashtable&, const ExitGames::Common::Hashtable&, int, const ExitGames::Common::JString&)
{
fmt::print("VRChad::VrcPhotonClient::joinOrCreateRoomReturn()\n");
}
void VRChad::PhotonClient::joinRandomOrCreateRoomReturn(int, const ExitGames::Common::Hashtable&, const ExitGames::Common::Hashtable&, int, const ExitGames::Common::JString&)
{
fmt::print("VRChad::VrcPhotonClient::joinRandomOrCreateRoomReturn()\n");
}
void VRChad::PhotonClient::joinRoomReturn(int, const ExitGames::Common::Hashtable&, const ExitGames::Common::Hashtable&, int, const ExitGames::Common::JString&)
{
fmt::print("VRChad::VrcPhotonClient::joinRoomReturn()\n");
}
void VRChad::PhotonClient::joinRandomRoomReturn(int, const ExitGames::Common::Hashtable&, const ExitGames::Common::Hashtable&, int, const ExitGames::Common::JString&)
{
fmt::print("VRChad::VrcPhotonClient::joinRandomRoomReturn()\n");
}
void VRChad::PhotonClient::leaveRoomReturn(int errorCode, const ExitGames::Common::JString& errorString)
{
fmt::print("VRChad::VrcPhotonClient::leaveRoomReturn()\n");
}
void VRChad::PhotonClient::joinLobbyReturn()
{
fmt::print("VRChad::VrcPhotonClient::joinLobbyReturn()\n");
}
void VRChad::PhotonClient::leaveLobbyReturn()
{
fmt::print("VRChad::VrcPhotonClient::leaveLobbyReturn()\n");
}
void VRChad::PhotonClient::onFindFriendsResponse()
{
fmt::print("VRChad::VrcPhotonClient::onFindFriendsResponse()\n");
}
void VRChad::PhotonClient::onLobbyStatsResponse(const ExitGames::Common::JVector<PhotonLB::LobbyStatsResponse>&)
{
fmt::print("VRChad::VrcPhotonClient::onLobbyStatsResponse()\n");
}
void VRChad::PhotonClient::webRpcReturn(int, const ExitGames::Common::JString&, const ExitGames::Common::JString&, int, const ExitGames::Common::Dictionary<ExitGames::Common::Object, ExitGames::Common::Object>&)
{
fmt::print("VRChad::VrcPhotonClient::webRpcReturn()\n");
}
void VRChad::PhotonClient::onRoomListUpdate()
{
fmt::print("VRChad::VrcPhotonClient::onRoomListUpdate()\n");
}
void VRChad::PhotonClient::onRoomPropertiesChange(const ExitGames::Common::Hashtable&)
{
fmt::print("VRChad::VrcPhotonClient::onRoomPropertiesChange()\n");
}
void VRChad::PhotonClient::onPlayerPropertiesChange(int, const ExitGames::Common::Hashtable&)
{
fmt::print("VRChad::VrcPhotonClient::onPlayerPropertiesChange()\n");
}
void VRChad::PhotonClient::onAppStatsUpdate()
{
fmt::print("VRChad::VrcPhotonClient::onAppStatsUpdate()\n");
}
void VRChad::PhotonClient::onLobbyStatsUpdate(const ExitGames::Common::JVector<PhotonLB::LobbyStatsResponse>&)
{
fmt::print("VRChad::VrcPhotonClient::onLobbyStatsUpdate()\n");
}
void VRChad::PhotonClient::onCacheSliceChanged(int)
{
fmt::print("VRChad::VrcPhotonClient::onCacheSliceChanged()\n");
}
void VRChad::PhotonClient::onMasterClientChanged(int, int)
{
fmt::print("VRChad::VrcPhotonClient::onMasterClientChanged()\n");
}
void VRChad::PhotonClient::onAvailableRegions(const ExitGames::Common::JVector<ExitGames::Common::JString>& names, const ExitGames::Common::JVector<ExitGames::Common::JString>& ips)
{
fmt::print("[Photon] Got available regions:\n");
for (std::uint32_t i = 0; i < names.getSize(); i++) {
std::string ip = utf8_encode_copy(ips[i]);
std::string name = utf8_encode_copy(names[i]);
fmt::print("\t{}:\t{}\n", name, ip);
m_regions[name] = ip;
}
if (m_regions.contains("eu")) {
m_cloudRegion = "eu";
} else if (m_regions.contains("us")) {
m_cloudRegion = "us";
} else if (m_regions.contains("usw")) {
m_cloudRegion = "usw";
} else {
m_cloudRegion = m_regions.begin()->first;
}
// Connect to the selected region
selectRegion(m_cloudRegion.data());
}
void VRChad::PhotonClient::onSecretReceival(const ExitGames::Common::JString& secret)
{
m_photonSecret = utf8_encode_copy(secret);
fmt::print("\n[Photon] Got secret: {}\n", m_photonSecret);
if (m_connectionState == ConnectionState::ConnectedToNameServer) {
connectToRegionMaster();
}
}
void VRChad::PhotonClient::onDirectConnectionEstablished(int)
{
fmt::print("VRChad::VrcPhotonClient::onDirectConnectionEstablished()\n");
}
void VRChad::PhotonClient::onDirectConnectionFailedToEstablish(int)
{
fmt::print("VRChad::VrcPhotonClient::onDirectConnectionFailedToEstablish()\n");
}
void VRChad::PhotonClient::onDirectMessage(const ExitGames::Common::Object&, int, bool)
{
fmt::print("VRChad::VrcPhotonClient::onDirectMessage()\n");
}
void VRChad::PhotonClient::onCustomOperationResponse(const ExitGames::Photon::OperationResponse&)
{
fmt::print("VRChad::VrcPhotonClient::onCustomOperationResponse()\n");
}
void VRChad::PhotonClient::onGetRoomListResponse(const ExitGames::Common::JVector<ExitGames::Common::Helpers::SharedPointer<PhotonLB::Room>>&, const ExitGames::Common::JVector<ExitGames::Common::JString>&)
{
fmt::print("VRChad::VrcPhotonClient::onGetRoomListResponse()\n");
}
void VRChad::PhotonClient::SetDisconnectIntention(DisconnectIntention disconnectIntention)
{
if (m_disconnectIntention != disconnectIntention) {
m_disconnectIntention = disconnectIntention;
switch (disconnectIntention) {
case DisconnectIntention::DisconnectedByServer:
case DisconnectIntention::DisconnectedByServerLogic:
case DisconnectIntention::DisconnectedByServerUserLimit:
SetConnectionState(ConnectionState::Disconnected);
break;
default:
break;
}
}
}
std::string_view VRChad::PhotonClient::GetDisconnectIntentionString()
{
using namespace std::literals;
switch (m_disconnectIntention) {
case DisconnectIntention::Disconnect:
return "Disconnect"sv;
break;
case DisconnectIntention::ConnectToNameServer:
return "Connect to nameserver"sv;
break;
case DisconnectIntention::ConnectToMasterServer:
return "Connect to masterserver"sv;
break;
case DisconnectIntention::ConnectToGameServer:
return "Connect to gameserver"sv;
break;
case DisconnectIntention::DisconnectedByServer:
return "Disconnected by server"sv;
break;
case DisconnectIntention::DisconnectedByServerLogic:
return "Disconnected by server logic"sv;
break;
case DisconnectIntention::DisconnectedByServerUserLimit:
return "Disconnected by server due to user limit"sv;
break;
default:
m_disconnectIntention = DisconnectIntention::Unknown;
case DisconnectIntention::Unknown:
return "Unknown"sv;
}
}
void VRChad::PhotonClient::SetConnectionState(ConnectionState connectionState)
{
if (m_connectionState != connectionState) {
m_connectionState = connectionState;
switch (connectionState) {
case ConnectionState::Disconnected:
fmt::print("[Photon] Disconnected, reason: {}\n", GetDisconnectIntentionString());
break;
case ConnectionState::ConnectingToNameServer:
SetDisconnectIntention(DisconnectIntention::Unknown);
fmt::print("[Photon] Connecting to nameserver\n");
break;
case ConnectionState::ConnectedToNameServer:
fmt::print("[Photon] Connected to nameserver\n");
break;
case ConnectionState::DisconnectingFromNameServer:
fmt::print("[Photon] Disconnecting from nameserver\n");
break;
case ConnectionState::ConnectingToMasterServer:
SetDisconnectIntention(DisconnectIntention::Unknown);
fmt::print("[Photon] Connecting to master server\n");
break;
case ConnectionState::ConnectedToMasterServer:
fmt::print("[Photon] Connected to master server\n");
break;
case ConnectionState::DisconnectingFromMasterServer:
fmt::print("[Photon] Disconnecting from master server\n");
break;
case ConnectionState::ConnectingToGameServer:
SetDisconnectIntention(DisconnectIntention::Unknown);
fmt::print("[Photon] Connecting to game server\n");
break;
case ConnectionState::ConnectedToGameServer:
fmt::print("[Photon] Connected to game server\n");
break;
case ConnectionState::DisconnectingFromGameServer:
fmt::print("[Photon] Disconnecting from game server\n");
break;
default:
break;
}
}
}
void VRChad::PhotonClient::SetConnectionStateAsConnected()
{
switch (m_connectionState) {
case ConnectionState::ConnectingToNameServer:
SetConnectionState(ConnectionState::ConnectedToNameServer);
break;
case ConnectionState::ConnectingToMasterServer:
SetConnectionState(ConnectionState::ConnectedToMasterServer);
break;
case ConnectionState::ConnectingToGameServer:
SetConnectionState(ConnectionState::ConnectedToNameServer);
break;
default:
break;
}
}
void VRChad::PhotonClient::SetConnectionStateAsDisconnecting()
{
switch (m_connectionState) {
case ConnectionState::ConnectedToNameServer:
SetConnectionState(ConnectionState::DisconnectingFromNameServer);
break;
case ConnectionState::ConnectedToMasterServer:
SetConnectionState(ConnectionState::DisconnectingFromMasterServer);
break;
case ConnectionState::ConnectedToGameServer:
SetConnectionState(ConnectionState::DisconnectingFromNameServer);
break;
default:
break;
}
}
bool VRChad::PhotonClient::GetConnectionStateIsConnected()
{
switch (m_connectionState) {
case ConnectionState::ConnectedToNameServer:
case ConnectionState::ConnectedToMasterServer:
case ConnectionState::ConnectedToGameServer:
return true;
default:
return false;
}
}