nodelay for MacOSX

This commit is contained in:
Sukchan Lee 2019-06-15 15:37:05 +09:00
parent 3d154cc423
commit 1542d70af6
1 changed files with 10 additions and 1 deletions

View File

@ -66,7 +66,8 @@ ogs_sock_t *ogs_sctp_socket(int family, int type, ogs_socknode_t *node)
.sctp.max_num_of_ostreams = DEFAULT_SCTP_MAX_NUM_OF_OSTREAMS,
.sctp.max_num_of_istreams = 65535,
.sctp.max_attempts = 4,
.sctp.max_initial_timeout = 8000 /* 8 seconds */
.sctp.max_initial_timeout = 8000, /* 8 seconds */
.nodelay = true /* Turn-on NODELAY */
};
ogs_sctp_set_option(&option, node);
@ -77,6 +78,14 @@ ogs_sock_t *ogs_sctp_socket(int family, int type, ogs_socknode_t *node)
return NULL;
}
if (option.nodelay) {
if (usrsctp_setsockopt(socket, IPPROTO_SCTP, SCTP_NODELAY,
&on, sizeof(int)) < 0) {
ogs_error("usrsctp_setsockopt SCTP_NODELAY failed");
return NULL;
}
}
if (usrsctp_setsockopt(socket, IPPROTO_SCTP, SCTP_RECVRCVINFO,
&on, sizeof(int)) < 0) {
ogs_error("usrsctp_setsockopt SCTP_RECVRCVINFO failed");