Ver código fonte

Add net teardown

Encapsulate net teardown logic.
master
TheoryOfNekomata 1 ano atrás
pai
commit
7556335605
3 arquivos alterados com 8 adições e 2 exclusões
  1. +1
    -2
      src/packages/game/IZ_app.c
  2. +5
    -0
      src/packages/net/IZ_net_client.c
  3. +2
    -0
      src/packages/net/IZ_net_client.h

+ 1
- 2
src/packages/game/IZ_app.c Ver arquivo

@@ -72,8 +72,7 @@ IZ_AppInitializeResult IZ_AppInitialize(struct IZ_App* app, u8 argc, const char*

void IZ_AppTeardown(struct IZ_App* app) {
IZ_PoolTeardown(&app->pool);
IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "net", "Shutting down...");
IZ_NetClientDisconnect(&app->net_state);
IZ_NetClientTeardown(&app->net_state);
IZ_InputTeardown(&app->input_state);
IZ_VideoTeardown(&app->video_state);
IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "global", "Stopping %s...", IZ_APP_NAME);


+ 5
- 0
src/packages/net/IZ_net_client.c Ver arquivo

@@ -122,6 +122,11 @@ IZ_ProcedureResult IZ_NetClientInitialize(
return 0;
}

void IZ_NetClientTeardown(IZ_NetClientState* state) {
IZ_LogInfo(IZ_LOG_CATEGORY_GLOBAL, "net", "Shutting down...");
IZ_NetClientDisconnect(state);
}

void IZ_NetClientConnect(IZ_NetClientState* state, IZ_WSClientInitializeParams params) {
if (!state->callback) {
return;


+ 2
- 0
src/packages/net/IZ_net_client.h Ver arquivo

@@ -77,4 +77,6 @@ void IZ_NetClientSendBinaryMessage(IZ_NetClientState*, void*, size_t);

void IZ_NetClientSendTextMessage(IZ_NetClientState*, char*, size_t);

void IZ_NetClientTeardown(IZ_NetClientState*);

#endif

Carregando…
Cancelar
Salvar