added connection_close;
This commit is contained in:
parent
bb28ee9a63
commit
f3d13966af
@ -195,6 +195,8 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* API */
|
/* API */
|
||||||
|
int sntl_init(void);
|
||||||
|
|
||||||
int connections_init(conn_sys_t *ssys);
|
int connections_init(conn_sys_t *ssys);
|
||||||
|
|
||||||
conn_sys_t *connections_create(void);
|
conn_sys_t *connections_create(void);
|
||||||
|
@ -746,6 +746,7 @@ static void *__sntll_thread(void *b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
__finish:
|
__finish:
|
||||||
|
co->flags |= SNSX_CLOSED;
|
||||||
__connection_destroy(co);
|
__connection_destroy(co);
|
||||||
__sntll_bundle_destroy(b); /* destroy bundle */
|
__sntll_bundle_destroy(b); /* destroy bundle */
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1143,3 +1144,20 @@ conn_t *connection_link(conn_sys_t *ssys, const char *host,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int connection_close(conn_t *co)
|
||||||
|
{
|
||||||
|
sntllv2_head_t mhead;
|
||||||
|
|
||||||
|
memset(&mhead, 0, sizeof(sntllv2_head_t));
|
||||||
|
/* setup header */
|
||||||
|
mhead.attr = SXMSG_LINK | SXMSG_CLOSED;
|
||||||
|
|
||||||
|
pthread_mutex_lock(&(co->sslinout[1]));
|
||||||
|
__conn_write(co, &mhead, sizeof(sntllv2_head_t));
|
||||||
|
pthread_mutex_unlock(&(co->sslinout[1]));
|
||||||
|
|
||||||
|
/* we will not wait anything */
|
||||||
|
co->flags |= SNSX_CLOSED;
|
||||||
|
|
||||||
|
return SNE_SUCCESS;
|
||||||
|
}
|
||||||
|
@ -275,6 +275,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
__wait_completion(&trd);
|
__wait_completion(&trd);
|
||||||
|
|
||||||
|
connection_close(co);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user