The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Notifier Class Reference

Used by m_mysql to notify one thread when the other has a result. More...

Inheritance diagram for Notifier:

Inheritance graph
[legend]
Collaboration diagram for Notifier:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Notifier (InspIRCd *SI)
 Notifier (InspIRCd *SI, int newfd, char *ip)
int GetPort ()
virtual int OnIncomingConnection (int newsock, char *ip)
 If your socket is a listening socket, when a new connection comes in on the socket this method will be called.
virtual bool OnDataReady ()
 When there is data waiting to be read on a socket, the OnDataReady() method is called.

Private Attributes

insp_sockaddr sock_us
socklen_t uslen

Detailed Description

Used by m_mysql to notify one thread when the other has a result.

Definition at line 631 of file m_mysql.cpp.


Constructor & Destructor Documentation

Notifier::Notifier InspIRCd SI  )  [inline]
 

Definition at line 643 of file m_mysql.cpp.

References sock_us, and uslen.

Referenced by OnIncomingConnection().

Notifier::Notifier InspIRCd SI,
int  newfd,
char *  ip
[inline]
 

Definition at line 653 of file m_mysql.cpp.


Member Function Documentation

int Notifier::GetPort  )  [inline]
 

Definition at line 658 of file m_mysql.cpp.

References sock_us.

Referenced by DispatcherThread().

virtual bool Notifier::OnDataReady  )  [inline, virtual]
 

When there is data waiting to be read on a socket, the OnDataReady() method is called.

Within this method, you *MUST* call the Read() method to read any pending data. At its lowest level, this event is signalled by the core via the socket engine. If you return false from this function, the core removes your socket from its list and erases it from the socket engine, then calls BufferedSocket::Close() and deletes it.

Returns:
false to close the socket

Reimplemented from BufferedSocket.

Definition at line 674 of file m_mysql.cpp.

References Connections, GetCharId(), BufferedSocket::Instance, SocketEngine::Recv(), results_mutex, and InspIRCd::SE.

virtual int Notifier::OnIncomingConnection int  newsock,
char *  ip
[inline, virtual]
 

If your socket is a listening socket, when a new connection comes in on the socket this method will be called.

Given the new file descriptor in the parameters, and the IP, it is recommended you copy them to a new instance of your socket class, e.g.:

MySocket* newsocket = new MySocket(newfd,ip);

Once you have done this, you can then associate the new socket with the core using Server::AddSocket().

Reimplemented from BufferedSocket.

Definition at line 667 of file m_mysql.cpp.

References Notifier().


Member Data Documentation

insp_sockaddr Notifier::sock_us [private]
 

Definition at line 633 of file m_mysql.cpp.

Referenced by GetPort(), and Notifier().

socklen_t Notifier::uslen [private]
 

Definition at line 634 of file m_mysql.cpp.

Referenced by Notifier().


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