MPD  0.20.6
Public Member Functions | Protected Member Functions
FullyBufferedSocket Class Reference

A BufferedSocket specialization that adds an output buffer. More...

#include <FullyBufferedSocket.hxx>

Inheritance diagram for FullyBufferedSocket:
[legend]
Collaboration diagram for FullyBufferedSocket:
[legend]

Public Member Functions

 FullyBufferedSocket (int _fd, EventLoop &_loop, size_t normal_size, size_t peak_size=0)
 
void Close ()
 

Protected Member Functions

bool Flush ()
 Send data from the output buffer to the socket. More...
 
bool Write (const void *data, size_t length)
 
virtual bool OnSocketReady (unsigned flags) override
 
virtual void OnIdle () override
 
- Protected Member Functions inherited from BufferedSocket
bool ResumeInput ()
 
void ConsumeInput (size_t nbytes)
 Mark a portion of the input buffer "consumed". More...
 
virtual InputResult OnSocketInput (void *data, size_t length)=0
 Data has been received on the socket. More...
 
virtual void OnSocketError (std::exception_ptr ep)=0
 
virtual void OnSocketClosed ()=0
 
 BufferedSocket (int _fd, EventLoop &_loop)
 
 SocketMonitor (EventLoop &_loop)
 
 SocketMonitor (int _fd, EventLoop &_loop)
 
 ~SocketMonitor ()
 
EventLoopGetEventLoop ()
 
bool IsDefined () const
 
int Get () const
 
void Open (int _fd)
 
int Steal ()
 "Steal" the socket descriptor. More...
 
void Abandon ()
 Somebody has closed the socket. More...
 
void Close ()
 
unsigned GetScheduledFlags () const
 
void Schedule (unsigned flags)
 
void Cancel ()
 
void ScheduleRead ()
 
void ScheduleWrite ()
 
void CancelRead ()
 
void CancelWrite ()
 
ssize_t Read (void *data, size_t length)
 
ssize_t Write (const void *data, size_t length)
 
void Dispatch (unsigned flags)
 

Additional Inherited Members

- Protected Types inherited from BufferedSocket
enum  InputResult { InputResult::MORE, InputResult::PAUSE, InputResult::AGAIN, InputResult::CLOSED }
 
- Protected Types inherited from SocketMonitor
typedef std::make_signed< size_t >::type ssize_t
 
- Static Protected Attributes inherited from SocketMonitor
static constexpr unsigned READ = PollGroup::READ
 
static constexpr unsigned WRITE = PollGroup::WRITE
 
static constexpr unsigned ERROR = PollGroup::ERROR
 
static constexpr unsigned HANGUP = PollGroup::HANGUP
 

Detailed Description

A BufferedSocket specialization that adds an output buffer.

Definition at line 31 of file FullyBufferedSocket.hxx.

Constructor & Destructor Documentation

FullyBufferedSocket::FullyBufferedSocket ( int  _fd,
EventLoop _loop,
size_t  normal_size,
size_t  peak_size = 0 
)
inline

Definition at line 35 of file FullyBufferedSocket.hxx.

Member Function Documentation

void FullyBufferedSocket::Close ( )
inline

Definition at line 43 of file FullyBufferedSocket.hxx.

bool FullyBufferedSocket::Flush ( )
protected

Send data from the output buffer to the socket.

Returns
false if the socket has been closed
virtual void FullyBufferedSocket::OnIdle ( )
overrideprotectedvirtual

Implements IdleMonitor.

virtual bool FullyBufferedSocket::OnSocketReady ( unsigned  flags)
overrideprotectedvirtual
Returns
false if the socket has been closed

Reimplemented from BufferedSocket.

bool FullyBufferedSocket::Write ( const void *  data,
size_t  length 
)
protected
Returns
false if the socket has been closed

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