add function sf_socket_close
parent
7c6673f78a
commit
32706b6275
|
|
@ -400,6 +400,19 @@ int sf_socket_server_ex(SFContext *sf_context)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void sf_socket_close_ex(SFContext *sf_context)
|
||||
{
|
||||
if (sf_context->inner_sock >= 0) {
|
||||
close(sf_context->inner_sock);
|
||||
sf_context->inner_sock = -1;
|
||||
}
|
||||
|
||||
if (sf_context->outer_sock >= 0) {
|
||||
close(sf_context->outer_sock);
|
||||
sf_context->outer_sock = -1;
|
||||
}
|
||||
}
|
||||
|
||||
static void accept_run(struct accept_thread_context *accept_context)
|
||||
{
|
||||
int incomesock;
|
||||
|
|
|
|||
|
|
@ -86,6 +86,9 @@ void sf_set_current_time();
|
|||
int sf_socket_server_ex(SFContext *sf_context);
|
||||
#define sf_socket_server() sf_socket_server_ex(&g_sf_context)
|
||||
|
||||
void sf_socket_close_ex(SFContext *sf_context);
|
||||
#define sf_socket_close() sf_socket_close_ex(&g_sf_context)
|
||||
|
||||
void sf_accept_loop_ex(SFContext *sf_context, const bool block);
|
||||
|
||||
#define sf_accept_loop() sf_accept_loop_ex(&g_sf_context, true)
|
||||
|
|
|
|||
Loading…
Reference in New Issue