5#ifndef WPINET_UV_NETWORKSTREAM_H_
6#define WPINET_UV_NETWORKSTREAM_H_
49 return std::static_pointer_cast<NetworkStream>(Handle::shared_from_this());
53 return std::static_pointer_cast<const NetworkStream>(
54 Handle::shared_from_this());
92 std::shared_ptr<NetworkStream>
Accept() {
112 bool Accept(
const std::shared_ptr<NetworkStream>& client) {
127template <
typename T,
typename U>
131 return std::static_pointer_cast<T>(Handle::shared_from_this());
135 return std::static_pointer_cast<const T>(Handle::shared_from_this());
SignalBase is an implementation of the observer pattern, through the use of an emitting object and sl...
Definition: Signal.h:495
Connection request.
Definition: NetworkStream.h:25
sig::Signal connected
Connection completed signal.
Definition: NetworkStream.h:36
NetworkStream & GetStream() const
Definition: NetworkStream.h:29
uv_handle_t * GetRawHandle() const noexcept
Get the underlying handle data structure.
Definition: Handle.h:176
bool Invoke(F &&f, Args &&... args) const
Definition: Handle.h:251
Network stream handle.
Definition: NetworkStream.h:44
std::shared_ptr< const NetworkStream > shared_from_this() const
Definition: NetworkStream.h:52
sig::Signal connection
Signal generated when an incoming connection is received.
Definition: NetworkStream.h:119
static constexpr int kDefaultBacklog
Definition: NetworkStream.h:46
std::shared_ptr< NetworkStream > Accept()
Accept incoming connection.
Definition: NetworkStream.h:92
virtual NetworkStream * DoAccept()=0
std::shared_ptr< NetworkStream > shared_from_this()
Definition: NetworkStream.h:48
void Listen(std::function< void()> callback, int backlog=kDefaultBacklog)
Start listening for incoming connections.
bool Accept(const std::shared_ptr< NetworkStream > &client)
Accept incoming connection.
Definition: NetworkStream.h:112
void Listen(int backlog=kDefaultBacklog)
Start listening for incoming connections.
NetworkStream(uv_stream_t *uv_stream)
Definition: NetworkStream.h:122
Definition: NetworkStream.h:128
std::shared_ptr< T > shared_from_this()
Definition: NetworkStream.h:130
U * GetRaw() const noexcept
Get the underlying handle data structure.
Definition: NetworkStream.h:143
std::shared_ptr< const T > shared_from_this() const
Definition: NetworkStream.h:134
NetworkStreamImpl()
Definition: NetworkStream.h:148
Request.
Definition: Request.h:130
uv_connect_t * GetRaw() noexcept
Get the underlying request data structure.
Definition: Request.h:145
Stream handle.
Definition: Stream.h:68
uv_stream_t * GetRawStream() const noexcept
Get the underlying stream data structure.
Definition: Stream.h:287
Definition: StdDeque.h:50
Definition: ParallelTcpConnector.h:22
uv_stream_t * handle
Definition: uv.h:593
UV_EXTERN int uv_accept(uv_stream_t *server, uv_stream_t *client)