diff --git a/rsplib/netutilities.c b/rsplib/netutilities.c index 414a45f..e2b9346 100644 --- a/rsplib/netutilities.c +++ b/rsplib/netutilities.c @@ -1862,110 +1862,6 @@ int connectplus(int sockfd, } -#ifdef LINUX -#ifdef HAVE_KERNEL_SCTP -#warning Using lksctp sctp_getladdrs()/sctp_getpaddrs() bugfix (at least libsctp<=1.0.7)! -/* - * Common getsockopt() layer - * If the NEW getsockopt() API fails this function will fall back to using - * the old API - */ -static int -sctp_getaddrs(int sd, sctp_assoc_t id, - int optname_new, int optname_num_old, int optname_old, - struct sockaddr **addrs) -{ - int cnt, err; - socklen_t len; - char *new_buf; - size_t bufsize = 4096; /*enough for most cases*/ - - struct sctp_getaddrs *getaddrs = (struct sctp_getaddrs*)malloc(bufsize); - if(!getaddrs) - return -1; - - for(;;) { - len = bufsize; - getaddrs->assoc_id = id; - err = getsockopt(sd, SOL_SCTP, optname_new, getaddrs, &len); - if (err == 0) { - /*got it*/ - break; - } - if (errno == ENOPROTOOPT) { - /*Kernel does not support new API*/ - free(getaddrs); -/* - return sctp_getaddrs_old(sd, id, - optname_num_old, optname_old, - addrs); -*/ - return -1; - } - if (errno != ENOMEM ) { - /*unknown error*/ - free(getaddrs); - return -1; - } - /*expand buffer*/ - if (bufsize > 128*1024) { - /*this is getting ridiculous*/ - free(getaddrs); - errno = ENOBUFS; - return -1; - } - new_buf = (char*)realloc(getaddrs, bufsize+4096); - if (!new_buf) { - free(getaddrs); - return -1; - } - bufsize += 4096; - getaddrs = (struct sctp_getaddrs*)new_buf; - } - - /* we skip traversing the list, allocating a new buffer etc. and enjoy - * a simple hack*/ - cnt = getaddrs->addr_num; - memmove(getaddrs, getaddrs + 1, len); // TD: corrent length value! -#ifdef HAVE_VALGRIND_MEMCHECK_H - VALGRIND_MAKE_MEM_DEFINED(getaddrs, len); -#endif - *addrs = (struct sockaddr*)getaddrs; - - return cnt; -} /* sctp_getaddrs() */ - -/* Get all peer address on a socket. This is a new SCTP API - * described in the section 8.3 of the Sockets API Extensions for SCTP. - * This is implemented using the getsockopt() interface. - */ -int -sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **addrs) -{ - return sctp_getaddrs(sd, id, - SCTP_GET_PEER_ADDRS, - SCTP_GET_PEER_ADDRS_NUM_OLD, - SCTP_GET_PEER_ADDRS_OLD, - addrs); -} /* sctp_getpaddrs() */ - -/* Get all locally bound address on a socket. This is a new SCTP API - * described in the section 8.5 of the Sockets API Extensions for SCTP. - * This is implemented using the getsockopt() interface. - */ -int -sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **addrs) -{ - return sctp_getaddrs(sd, id, - SCTP_GET_LOCAL_ADDRS, - SCTP_GET_LOCAL_ADDRS_NUM_OLD, - SCTP_GET_LOCAL_ADDRS_OLD, - addrs); -} /* sctp_getladdrs() */ -#endif -#endif - - /* ###### Get local addresses ############################################### */ size_t getladdrsplus(const int fd, const sctp_assoc_t assocID, diff --git a/rsplib/udplikeserver.cc b/rsplib/udplikeserver.cc index 62ae2b9..66b5328 100644 --- a/rsplib/udplikeserver.cc +++ b/rsplib/udplikeserver.cc @@ -38,6 +38,8 @@ #include #include +#include + // ###### Constructor ####################################################### UDPLikeServer::UDPLikeServer() @@ -272,7 +274,7 @@ void UDPLikeServer::poolElement(const char* programTitle, timeout = 0; } else { - timeout = min(timeout, NextTimerTimeStamp - now); + timeout = std::min(timeout, NextTimerTimeStamp - now); } }