浏览代码

Add net teardown

Encapsulate net teardown logic.
master
父节点
当前提交
7556335605
共有 3 个文件被更改,包括 8 次插入2 次删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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

正在加载...
取消
保存