Made FD_SETSIZE configurable on glibc >= 2.2 - thanks, Squid authors!
git-svn-id: http://voip.null.ro/svn/yate@458 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
1b80715251
commit
d6751b10ac
|
@ -116,6 +116,13 @@ esac
|
|||
AC_MSG_RESULT([$want_inline])
|
||||
AC_SUBST(INLINE_FLAGS)
|
||||
|
||||
FDSIZE_HACK=""
|
||||
AC_ARG_WITH(fdsize,AC_HELP_STRING([--with-fdsize=NNNN],[set FD_SIZE to NNNN (default 4096)]),[ac_cv_use_fdsize=$withval],[ac_cv_use_fdsize=4096])
|
||||
if [[ "x$ac_cv_use_fdsize" != "xno" ]]; then
|
||||
FDSIZE_HACK="-DFDSIZE_HACK=$ac_cv_use_fdsize"
|
||||
fi
|
||||
AC_SUBST(FDSIZE_HACK)
|
||||
|
||||
# Checks for optional libraries.
|
||||
|
||||
HAVE_PGSQL=no
|
||||
|
|
|
@ -178,6 +178,7 @@ bool RTPReceiver::decodeEvent(bool marker, unsigned int timestamp, const void* d
|
|||
if (!end)
|
||||
return true;
|
||||
// FIXME: add code to push the event and also filter dumb senders
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RTPReceiver::decodeSilence(bool marker, unsigned int timestamp, const void* data, int len)
|
||||
|
@ -397,7 +398,9 @@ RTPReceiver* RTPSession::createReceiver()
|
|||
|
||||
RTPTransport* RTPSession::createTransport()
|
||||
{
|
||||
return new RTPTransport(group());
|
||||
RTPTransport* trans = new RTPTransport();
|
||||
trans->group(group());
|
||||
return trans;
|
||||
}
|
||||
|
||||
bool RTPSession::initGroup()
|
||||
|
|
|
@ -30,23 +30,27 @@ using namespace TelEngine;
|
|||
RTPGroup::RTPGroup(Priority prio)
|
||||
: Mutex(true), Thread("RTP Group",prio)
|
||||
{
|
||||
XDebug(DebugInfo,"RTPGroup::RTPGroup() [%p]",this);
|
||||
DDebug(DebugInfo,"RTPGroup::RTPGroup() [%p]",this);
|
||||
}
|
||||
|
||||
RTPGroup::~RTPGroup()
|
||||
{
|
||||
XDebug(DebugInfo,"RTPGroup::~RTPGroup() [%p]",this);
|
||||
DDebug(DebugInfo,"RTPGroup::~RTPGroup() [%p]",this);
|
||||
}
|
||||
|
||||
void RTPGroup::cleanup()
|
||||
{
|
||||
XDebug(DebugInfo,"RTPGroup::cleanup() [%p]",this);
|
||||
DDebug(DebugInfo,"RTPGroup::cleanup() [%p]",this);
|
||||
lock();
|
||||
ObjList* l = &m_processors;
|
||||
for (;l;l = l->next()) {
|
||||
while (l) {
|
||||
RTPProcessor* p = static_cast<RTPProcessor*>(l->get());
|
||||
if (p)
|
||||
if (p) {
|
||||
p->group(0);
|
||||
if (p != static_cast<RTPProcessor*>(l->get()))
|
||||
continue;
|
||||
}
|
||||
l = l->next();
|
||||
}
|
||||
m_processors.clear();
|
||||
unlock();
|
||||
|
@ -54,6 +58,7 @@ void RTPGroup::cleanup()
|
|||
|
||||
void RTPGroup::run()
|
||||
{
|
||||
DDebug(DebugInfo,"RTPGroup::run() [%p]",this);
|
||||
bool ok = true;
|
||||
while (ok) {
|
||||
lock();
|
||||
|
@ -69,12 +74,12 @@ void RTPGroup::run()
|
|||
unlock();
|
||||
Thread::msleep(1,true);
|
||||
}
|
||||
XDebug(DebugInfo,"RTPGroup::run() ran out of processors [%p]",this);
|
||||
DDebug(DebugInfo,"RTPGroup::run() ran out of processors [%p]",this);
|
||||
}
|
||||
|
||||
void RTPGroup::join(RTPProcessor* proc)
|
||||
{
|
||||
XDebug(DebugAll,"RTPGroup::join(%p) [%p]",proc,this);
|
||||
DDebug(DebugAll,"RTPGroup::join(%p) [%p]",proc,this);
|
||||
lock();
|
||||
m_processors.append(proc)->setDelete(false);
|
||||
startup();
|
||||
|
@ -83,28 +88,27 @@ void RTPGroup::join(RTPProcessor* proc)
|
|||
|
||||
void RTPGroup::part(RTPProcessor* proc)
|
||||
{
|
||||
XDebug(DebugAll,"RTPGroup::part(%p) [%p]",proc,this);
|
||||
DDebug(DebugAll,"RTPGroup::part(%p) [%p]",proc,this);
|
||||
lock();
|
||||
m_processors.remove(proc,false);
|
||||
unlock();
|
||||
}
|
||||
|
||||
RTPProcessor::RTPProcessor(RTPGroup* grp)
|
||||
RTPProcessor::RTPProcessor()
|
||||
: m_group(0)
|
||||
{
|
||||
XDebug(DebugAll,"RTPProcessor::RTPProcessor(%p) [%p]",grp,this);
|
||||
group(grp);
|
||||
DDebug(DebugAll,"RTPProcessor::RTPProcessor() [%p]",this);
|
||||
}
|
||||
|
||||
RTPProcessor::~RTPProcessor()
|
||||
{
|
||||
XDebug(DebugAll,"RTPProcessor::~RTPProcessor() [%p]",this);
|
||||
DDebug(DebugAll,"RTPProcessor::~RTPProcessor() [%p]",this);
|
||||
group(0);
|
||||
}
|
||||
|
||||
void RTPProcessor::group(RTPGroup* newgrp)
|
||||
{
|
||||
XDebug(DebugAll,"RTPProcessor::group(%p) old=%p [%p]",newgrp,m_group,this);
|
||||
DDebug(DebugAll,"RTPProcessor::group(%p) old=%p [%p]",newgrp,m_group,this);
|
||||
if (newgrp == m_group)
|
||||
return;
|
||||
if (m_group)
|
||||
|
@ -114,20 +118,23 @@ void RTPProcessor::group(RTPGroup* newgrp)
|
|||
m_group->join(this);
|
||||
}
|
||||
|
||||
RTPTransport::RTPTransport(RTPGroup* grp)
|
||||
: RTPProcessor(grp),
|
||||
RTPTransport::RTPTransport()
|
||||
: RTPProcessor(),
|
||||
m_processor(0), m_monitor(0)
|
||||
{
|
||||
DDebug(DebugAll,"RTPTransport::RTPTransport() [%p]",this);
|
||||
}
|
||||
|
||||
RTPTransport::~RTPTransport()
|
||||
{
|
||||
DDebug(DebugAll,"RTPTransport::~RTPTransport() [%p]",this);
|
||||
setProcessor();
|
||||
group(0);
|
||||
}
|
||||
|
||||
void RTPTransport::timerTick(const Time& when)
|
||||
{
|
||||
XDebug(DebugAll,"RTPTransport::timerTick() group=%p [%p]",group(),this);
|
||||
if (m_rtpSock.valid()) {
|
||||
bool ok = false;
|
||||
struct timeval tv;
|
||||
|
|
|
@ -60,10 +60,9 @@ class YRTP_API RTPProcessor : public GenObject
|
|||
|
||||
public:
|
||||
/**
|
||||
* Constructor - inserts itself in a RTP group
|
||||
* @param grp RTP group to join
|
||||
* Constructor - processor should be later inserted in a RTP group
|
||||
*/
|
||||
RTPProcessor(RTPGroup* grp = 0);
|
||||
RTPProcessor();
|
||||
|
||||
/**
|
||||
* Destructor - removes itself from the RTP group
|
||||
|
@ -170,10 +169,10 @@ public:
|
|||
};
|
||||
|
||||
/**
|
||||
* Constructor, creates a transport optionally joined to a group
|
||||
* Constructor, creates an unconnected transport
|
||||
* @param grp RTP group to join
|
||||
*/
|
||||
RTPTransport(RTPGroup* grp = 0);
|
||||
RTPTransport();
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
|
|
|
@ -362,6 +362,7 @@ void Channel::callAccept(Message& msg)
|
|||
|
||||
void Channel::callRejected(const char* error, const char* reason, const Message* msg)
|
||||
{
|
||||
Debug(this,DebugMild,"Call rejected error='%s' reason='%s' [%p]",error,reason,this);
|
||||
status("rejected");
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,9 @@ Channel.o: @srcdir@/Channel.cpp $(MKDEPS) $(PINC)
|
|||
DataFormat.o: @srcdir@/DataFormat.cpp $(MKDEPS) $(PINC)
|
||||
$(COMPILE) -c $<
|
||||
|
||||
Socket.o: @srcdir@/Socket.cpp $(MKDEPS) $(CINC)
|
||||
$(COMPILE) @FDSIZE_HACK@ -c $<
|
||||
|
||||
Mutex.o: @srcdir@/Mutex.cpp $(MKDEPS) $(CINC)
|
||||
$(COMPILE) @MUTEX_HACK@ -c $<
|
||||
|
||||
|
|
|
@ -20,6 +20,17 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifdef FDSIZE_HACK
|
||||
#include <features.h>
|
||||
#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
|
||||
#include <bits/types.h>
|
||||
#undef __FD_SETSIZE
|
||||
#define __FD_SETSIZE FDSIZE_HACK
|
||||
#else
|
||||
#error Cannot set FD_SETSIZE on this platform - please ./configure --without-fdsize and hope it works
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "yateclass.h"
|
||||
|
||||
#include <string.h>
|
||||
|
@ -504,6 +515,19 @@ int Socket::readData(void* buffer, int length)
|
|||
|
||||
bool Socket::select(bool* readok, bool* writeok, bool* except, struct timeval* timeout)
|
||||
{
|
||||
#ifdef FD_SETSIZE
|
||||
#ifndef _WINDOWS
|
||||
static bool localFail = true;
|
||||
if (m_handle >= FD_SETSIZE) {
|
||||
if (localFail) {
|
||||
localFail = false;
|
||||
Debug(DebugFail,"Socket::select: handle %d larger than compiled in maximum %d",
|
||||
m_handle,FD_SETSIZE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
fd_set readfd,writefd,exceptfd;
|
||||
fd_set *rfds = 0;
|
||||
fd_set *wfds = 0;
|
||||
|
|
Loading…
Reference in New Issue