forked from acouzens/open5gs
[SGsAP] Add linger option in usrsctp
This commit is contained in:
parent
fba54b09eb
commit
4013d9203c
|
@ -1 +1 @@
|
|||
Subproject commit 74d0df2b5b6d2502f56ff54deb4941f2fbbd5253
|
||||
Subproject commit 2a609cc8e33e6288a1f56af595ef677884af1591
|
|
@ -42,6 +42,7 @@ void ogs_sctp_final()
|
|||
ogs_sock_t *ogs_sctp_socket(int family, int type, ogs_socknode_t *node)
|
||||
{
|
||||
struct socket *socket = NULL;
|
||||
struct linger l;
|
||||
const int on = 1;
|
||||
struct sctp_event event;
|
||||
uint16_t event_types[] = {
|
||||
|
@ -83,6 +84,16 @@ ogs_sock_t *ogs_sctp_socket(int family, int type, ogs_socknode_t *node)
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
if (node->option.l_onoff) {
|
||||
memset(&l, 0, sizeof(l));
|
||||
l.l_onoff = node->option.l_onoff;
|
||||
l.l_linger = node->option.l_linger;
|
||||
if (usrsctp_setsockopt(socket, SOL_SOCKET, SO_LINGER,
|
||||
(const void *)&l, (socklen_t) sizeof(struct linger)) < 0) {
|
||||
ogs_error("Could not set SO_LINGER on SCTP socket");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (usrsctp_setsockopt(socket, IPPROTO_SCTP, SCTP_RECVRCVINFO,
|
||||
|
|
|
@ -39,6 +39,7 @@ ogs_sock_t *sgsap_client(mme_vlr_t *vlr)
|
|||
|
||||
ogs_socknode_sctp_option(node, &context_self()->config.sockopt);
|
||||
ogs_socknode_nodelay(node, true);
|
||||
ogs_socknode_linger(node, true, 0);
|
||||
ogs_socknode_set_poll(node, mme_self()->pollset,
|
||||
OGS_POLLIN, usrsctp_recv_handler, node);
|
||||
|
||||
|
|
Loading…
Reference in New Issue