reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
resip::FdPollImplFdSet Class Reference
Inheritance diagram for resip::FdPollImplFdSet:
[legend]

Public Member Functions

 FdPollImplFdSet ()
 
 ~FdPollImplFdSet ()
 
virtual const char * getImplName () const
 
virtual ImplType getImplType () const
 
virtual FdPollItemHandle addPollItem (Socket fd, FdPollEventMask newMask, FdPollItemIf *item)
 
virtual void modPollItem (FdPollItemHandle handle, FdPollEventMask newMask)
 
virtual void delPollItem (FdPollItemHandle handle)
 
virtual bool waitAndProcess (int ms=0)
 Wait at most {ms} milliseconds.
 
virtual void buildFdSet (FdSet &fdSet)
 
virtual bool processFdSet (FdSet &fdset)
 
- Public Member Functions inherited from resip::FdPollGrp
 FdPollGrp ()
 
virtual ~FdPollGrp ()
 
virtual int getEPollFd () const
 get the epoll-fd (epoll_create()) This is fd (type int), not Socket.
 

Protected Member Functions

void killCache (Socket fd)
 There is a boundary case:
 
- Protected Member Functions inherited from resip::FdPollGrp
void processItem (FdPollItemIf *item, FdPollEventMask mask)
 

Protected Attributes

std::vector< FdPollItemFdSetInfo > mItems
 
size_t mLiveHeadIdx
 
size_t mFreeHeadIdx
 
FdSet mSelectSet
 

Additional Inherited Members

- Public Types inherited from resip::FdPollGrp
enum  ImplType { FdSetImpl = 0 , PollImpl , EPollImpl }
 
- Static Public Member Functions inherited from resip::FdPollGrp
static FdPollGrp * create (const char *implName=NULL)
 factory
 
static const char * getImplList ()
 Return candidate impl names with vertical bar (|) between them Intended for help messages.
 

Detailed Description

Definition at line 123 of file FdPoll.cxx.

Constructor & Destructor Documentation

◆ FdPollImplFdSet()

FdPollImplFdSet::FdPollImplFdSet ( )

Definition at line 169 of file FdPoll.cxx.

◆ ~FdPollImplFdSet()

FdPollImplFdSet::~FdPollImplFdSet ( )

Definition at line 174 of file FdPoll.cxx.

Member Function Documentation

◆ addPollItem()

FdPollItemHandle FdPollImplFdSet::addPollItem ( Socket  fd,
FdPollEventMask  newMask,
FdPollItemIf *  item 
)
virtual

Implements resip::FdPollGrp.

Definition at line 189 of file FdPoll.cxx.

◆ buildFdSet()

void FdPollImplFdSet::buildFdSet ( FdSet &  fdSet)
virtual

Implements resip::FdPollGrp.

Definition at line 333 of file FdPoll.cxx.

◆ delPollItem()

void FdPollImplFdSet::delPollItem ( FdPollItemHandle  handle)
virtual

Implements resip::FdPollGrp.

Definition at line 251 of file FdPoll.cxx.

◆ getImplName()

virtual const char * resip::FdPollImplFdSet::getImplName ( ) const
inlinevirtual

Implements resip::FdPollGrp.

Definition at line 129 of file FdPoll.cxx.

◆ getImplType()

virtual ImplType resip::FdPollImplFdSet::getImplType ( ) const
inlinevirtual

Implements resip::FdPollGrp.

Definition at line 130 of file FdPoll.cxx.

◆ killCache()

void FdPollImplFdSet::killCache ( Socket  fd)
protected

There is a boundary case:

  1. fdA and fdB are added to epoll
  2. events occur on fdA and fdB
  1. waitAndProcess() select and gets events for fdA and fdB
  2. handler for fdA deletes fdB (closing fd)
  3. handler (same or differnt) opens new fd, gets fd as fdB, and adds it to us but under different object
  4. cache processes "old" fdB event masks but binds it to the new (wrong) object

For read or write events it would be relatively harmless to pass these events to the new object (all objects should be prepared to get EAGAIN). But passing an error event could incorrectly kill the wrong object.

To prevent this, we kill the events in the mSelectSet. In POSIX, I'm pretty sure this is always safe. In Windows, I don't know what happens if the fd isn't already in the FdSet.

Definition at line 291 of file FdPoll.cxx.

◆ modPollItem()

void FdPollImplFdSet::modPollItem ( FdPollItemHandle  handle,
FdPollEventMask  newMask 
)
virtual

Implements resip::FdPollGrp.

Definition at line 232 of file FdPoll.cxx.

◆ processFdSet()

bool FdPollImplFdSet::processFdSet ( FdSet &  fdset)
virtual

Implements resip::FdPollGrp.

Definition at line 367 of file FdPoll.cxx.

◆ waitAndProcess()

bool FdPollImplFdSet::waitAndProcess ( int  ms = 0)
virtual

Wait at most {ms} milliseconds.

If any file activity has already occurs or occurs before {ms} expires, then FdPollItem will be informed (via cb method) and this method will return. Returns true iff any file activity occured. ms<0: wait forever, ms=0: don't wait, ms>0: wait this long NOTE: "forever" may be a little as 60sec or as much as forever

Implements resip::FdPollGrp.

Definition at line 297 of file FdPoll.cxx.

Member Data Documentation

◆ mFreeHeadIdx

size_t resip::FdPollImplFdSet::mFreeHeadIdx
protected

Definition at line 153 of file FdPoll.cxx.

◆ mItems

std::vector<FdPollItemFdSetInfo> resip::FdPollImplFdSet::mItems
protected

Definition at line 143 of file FdPoll.cxx.

◆ mLiveHeadIdx

size_t resip::FdPollImplFdSet::mLiveHeadIdx
protected

Definition at line 152 of file FdPoll.cxx.

◆ mSelectSet

FdSet resip::FdPollImplFdSet::mSelectSet
protected

Definition at line 160 of file FdPoll.cxx.


The documentation for this class was generated from the following file: