mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
For #307, Support disable sendmmsg
This commit is contained in:
parent
6f7ebbdc5f
commit
b8db61bd9c
4 changed files with 14 additions and 5 deletions
|
@ -165,6 +165,11 @@ if [ $SRS_SENDMMSG = YES ]; then
|
||||||
else
|
else
|
||||||
srs_undefine_macro "SRS_AUTO_SENDMMSG" $SRS_AUTO_HEADERS_H
|
srs_undefine_macro "SRS_AUTO_SENDMMSG" $SRS_AUTO_HEADERS_H
|
||||||
fi
|
fi
|
||||||
|
if [ $SRS_HAS_SENDMMSG = YES ]; then
|
||||||
|
srs_define_macro "SRS_AUTO_HAS_SENDMMSG" $SRS_AUTO_HEADERS_H
|
||||||
|
else
|
||||||
|
srs_undefine_macro "SRS_AUTO_HAS_SENDMMSG" $SRS_AUTO_HEADERS_H
|
||||||
|
fi
|
||||||
|
|
||||||
# prefix
|
# prefix
|
||||||
echo "" >> $SRS_AUTO_HEADERS_H
|
echo "" >> $SRS_AUTO_HEADERS_H
|
||||||
|
|
|
@ -121,6 +121,7 @@ SRS_EXTRA_FLAGS=
|
||||||
SRS_NASM=YES
|
SRS_NASM=YES
|
||||||
SRS_SRTP_ASM=YES
|
SRS_SRTP_ASM=YES
|
||||||
SRS_SENDMMSG=YES
|
SRS_SENDMMSG=YES
|
||||||
|
SRS_HAS_SENDMMSG=YES
|
||||||
|
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
# menu
|
# menu
|
||||||
|
@ -564,9 +565,12 @@ function apply_user_detail_options() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
grep -qs sendmmsg /usr/include/sys/socket.h
|
grep -qs sendmmsg /usr/include/sys/socket.h
|
||||||
if [[ $? -ne 0 && $SRS_SENDMMSG == YES ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "Disable UDP sendmmsg automatically"
|
SRS_HAS_SENDMMSG=NO
|
||||||
SRS_SENDMMSG=NO
|
if [[ $SRS_SENDMMSG == YES ]]; then
|
||||||
|
echo "Disable UDP sendmmsg automatically"
|
||||||
|
SRS_SENDMMSG=NO
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
apply_user_detail_options
|
apply_user_detail_options
|
||||||
|
|
|
@ -409,7 +409,7 @@ int srs_sendmsg(srs_netfd_t stfd, const struct msghdr *msg, int flags, srs_utime
|
||||||
|
|
||||||
int srs_sendmmsg(srs_netfd_t stfd, struct mmsghdr *msgvec, unsigned int vlen, int flags, srs_utime_t timeout)
|
int srs_sendmmsg(srs_netfd_t stfd, struct mmsghdr *msgvec, unsigned int vlen, int flags, srs_utime_t timeout)
|
||||||
{
|
{
|
||||||
#if defined(SRS_AUTO_OSX) || !defined(SRS_AUTO_SENDMMSG)
|
#if !defined(SRS_AUTO_HAS_SENDMMSG) || !defined(SRS_AUTO_SENDMMSG)
|
||||||
// @see http://man7.org/linux/man-pages/man2/sendmmsg.2.html
|
// @see http://man7.org/linux/man-pages/man2/sendmmsg.2.html
|
||||||
for (int i = 0; i < (int)vlen; ++i) {
|
for (int i = 0; i < (int)vlen; ++i) {
|
||||||
struct mmsghdr* p = msgvec + i;
|
struct mmsghdr* p = msgvec + i;
|
||||||
|
|
|
@ -91,7 +91,7 @@ extern int srs_recvfrom(srs_netfd_t stfd, void *buf, int len, struct sockaddr *f
|
||||||
extern int srs_sendto(srs_netfd_t stfd, void *buf, int len, const struct sockaddr *to, int tolen, srs_utime_t timeout);
|
extern int srs_sendto(srs_netfd_t stfd, void *buf, int len, const struct sockaddr *to, int tolen, srs_utime_t timeout);
|
||||||
extern int srs_sendmsg(srs_netfd_t stfd, const struct msghdr *msg, int flags, srs_utime_t timeout);
|
extern int srs_sendmsg(srs_netfd_t stfd, const struct msghdr *msg, int flags, srs_utime_t timeout);
|
||||||
|
|
||||||
#if !defined(SRS_AUTO_SENDMMSG)
|
#if !defined(SRS_AUTO_HAS_SENDMMSG)
|
||||||
// @see http://man7.org/linux/man-pages/man2/sendmmsg.2.html
|
// @see http://man7.org/linux/man-pages/man2/sendmmsg.2.html
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
struct mmsghdr {
|
struct mmsghdr {
|
||||||
|
|
Loading…
Reference in a new issue