Skip to content

Commit

Permalink
fix soak
Browse files Browse the repository at this point in the history
  • Loading branch information
nathhB committed Sep 23, 2023
1 parent d495c64 commit c6091b5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 27 deletions.
24 changes: 12 additions & 12 deletions soak/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,22 @@ int main(int argc, char *argv[])
NBN_UDP_Register(); // Register the UDP driver
#endif // __EMSCRIPTEN__

if (NBN_GameClient_Start(SOAK_PROTOCOL_NAME, "127.0.0.1", SOAK_PORT) < 0)
{
Soak_LogError("Failed to start game client. Exit");

#ifdef __EMSCRIPTEN__
emscripten_force_exit(1);
#else
return 1;
#endif
}

if (Soak_Init(argc, argv) < 0)
{
Soak_LogError("Failed to initialize soak test");
return 1;
}
}

SoakOptions options = Soak_GetOptions();
unsigned int channel_count = options.channel_count;
Expand All @@ -289,17 +300,6 @@ int main(int argc, char *argv[])
unsigned int leftover_message_count = message_count % channel_count;
SoakChannel *channels = (SoakChannel *)malloc(sizeof(SoakChannel) * channel_count);

if (NBN_GameClient_Start(SOAK_PROTOCOL_NAME, "127.0.0.1", SOAK_PORT) < 0)
{
Soak_LogError("Failed to start game client. Exit");

#ifdef __EMSCRIPTEN__
emscripten_force_exit(1);
#else
return 1;
#endif
}

for (int c = 0; c < channel_count; c++)
{
SoakChannel *channel = &channels[c];
Expand Down
14 changes: 7 additions & 7 deletions soak/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,24 +346,24 @@ int main(int argc, char *argv[])
NBN_WebRTC_C_Register(); // Register native WebRTC driver
#endif

#endif // __EMSCRIPTEN__
#endif // __EMSCRIPTEN__

if (Soak_Init(argc, argv) < 0)
if (NBN_GameServer_Start(SOAK_PROTOCOL_NAME, SOAK_PORT))
{
Soak_LogError("Failed to initialize soak test");
Soak_LogError("Failed to start game server");

return 1;
}

NBN_GameServer_Debug_RegisterCallback(NBN_DEBUG_CB_MSG_ADDED_TO_RECV_QUEUE, (void *)Soak_Debug_PrintAddedToRecvQueue);

if (NBN_GameServer_Start(SOAK_PROTOCOL_NAME, SOAK_PORT))
if (Soak_Init(argc, argv) < 0)
{
Soak_LogError("Failed to start game server");
Soak_LogError("Failed to initialize soak test");

return 1;
}

NBN_GameServer_Debug_RegisterCallback(NBN_DEBUG_CB_MSG_ADDED_TO_RECV_QUEUE, (void *)Soak_Debug_PrintAddedToRecvQueue);

int ret = Soak_MainLoop(Tick, NULL);

NBN_GameServer_Stop();
Expand Down
8 changes: 0 additions & 8 deletions soak/soak.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ int Soak_Init(int argc, char *argv[])
NBN_GameClient_RegisterReliableChannel(i);
}

#ifdef SOAK_ENCRYPTION
NBN_GameClient_EnableEncryption();
#endif

NBN_GameClient_RegisterMessage(SOAK_MESSAGE,
(NBN_MessageBuilder)SoakMessage_CreateIncoming,
(NBN_MessageDestructor)SoakMessage_Destroy,
Expand All @@ -92,10 +88,6 @@ int Soak_Init(int argc, char *argv[])
NBN_GameServer_RegisterReliableChannel(i);
}

#ifdef SOAK_ENCRYPTION
NBN_GameServer_EnableEncryption();
#endif

NBN_GameServer_RegisterMessage(SOAK_MESSAGE,
(NBN_MessageBuilder)SoakMessage_CreateIncoming,
(NBN_MessageDestructor)SoakMessage_Destroy,
Expand Down
1 change: 1 addition & 0 deletions soak/soak_cli_out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./bin/github-actions/run_soak.sh: line 38: ./client: No such file or directory
1 change: 1 addition & 0 deletions soak/soak_serv_out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./bin/github-actions/run_soak.sh: line 18: ./server: No such file or directory

0 comments on commit c6091b5

Please sign in to comment.