security communication with openssl and simplify netio

This commit is contained in:
Rongsong Shen 2025-11-18 11:21:24 +08:00
parent 2a7b7c39bb
commit 8f796b3109
20 changed files with 1176 additions and 922 deletions

View file

@ -53,6 +53,9 @@ int xcecli_ctx_init(xcecli_ctx_t* c, xce_client_config_t* cfg)
endpoint_init(&(ctx->ep), AF_INET, SOCK_STREAM, 0, 0);
/* set information for endpoint */
endpoint_set_peer(&(ctx->ep), &(ctx->ctx.myinfo));
xce_ctx_set_endpoint(&(ctx->ctx), &(ctx->ep));
*c = (void*)ctx;
@ -68,7 +71,7 @@ void xcecli_ctx_fini(xcecli_ctx_t c)
}
xce_ctx_fini(&(ctx->ctx));
endpoint_deref(&(ctx->ep));
endpoint_fini(&(ctx->ep));
free(ctx);
}
@ -118,11 +121,13 @@ int xcecli_start(xcecli_ctx_t c)
rc = endpoint_connect(&(ctx->ep), ctx->conf->masters[0],
ctx->conf->master_ports[0]);
if (rc < 0) {
endpoint_deref(&(ctx->ep));
endpoint_fini(&(ctx->ep));
return rc;
}
return xce_ctx_start(&(ctx->ctx));
rc = xce_ctx_start(&(ctx->ctx));
return rc;
}
int xcecli_stop(xcecli_ctx_t c)
@ -134,7 +139,7 @@ int xcecli_stop(xcecli_ctx_t c)
}
xce_ctx_stop(&(ctx->ctx));
endpoint_deref(&(ctx->ep));
endpoint_fini(&(ctx->ep));
return 0;
}