#ifndef MSP_NET_SOCKET_H_
#define MSP_NET_SOCKET_H_
+#include <memory>
#include <msp/core/except.h>
#include <msp/io/eventobject.h>
#include <msp/io/handle.h>
struct Private;
- Private *priv = nullptr;
- SockAddr *local_addr = nullptr;
+ std::unique_ptr<Private> priv;
+ std::unique_ptr<SockAddr> local_addr;
Socket(const Private &);
Socket(Family, int, int);
void set_block(bool) override;
void set_inherit(bool) override;
- const IO::Handle &get_handle(IO::Mode);
+ const IO::Handle &get_handle(IO::Mode) override;
const IO::Handle &get_event_handle() override;
/** Associates the socket with a local address. There must be no existing
users of the address. */
void bind(const SockAddr &);
- bool is_bound() const { return local_addr; }
+ bool is_bound() const { return static_cast<bool>(local_addr); }
const SockAddr &get_local_address() const;
void set_timeout(const Time::TimeDelta &);