From 5c12d5b387e07203be79df7e4d526d124a53ad8a Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 5 Nov 2016 15:00:09 +0100 Subject: Do not use boost::optional for TcpSocket Older boost versions require T to be copy-constructable in optional. This is not the case for TcpSocket, which is only move-constructable. Fixes compilation on debian jessie --- src/TcpSocket.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/TcpSocket.h') diff --git a/src/TcpSocket.h b/src/TcpSocket.h index 8df913f..660515d 100644 --- a/src/TcpSocket.h +++ b/src/TcpSocket.h @@ -46,7 +46,7 @@ #include #include -#include +#include /** * This class represents a TCP socket. @@ -70,7 +70,9 @@ class TcpSocket TcpSocket(const TcpSocket& other) = delete; TcpSocket& operator=(const TcpSocket& other) = delete; - int close(); + bool isValid(void); + + int close(void); /** Send data over the TCP connection. * @param data The buffer that will be sent. @@ -88,7 +90,12 @@ class TcpSocket void listen(void); TcpSocket accept(void); - boost::optional accept(int timeout_ms); + + /* Returns either valid socket if a connection was + * accepted before the timeout expired, or an invalid + * socket otherwise. + */ + TcpSocket accept(int timeout_ms); /** Retrieve address this socket is bound to */ InetAddress getOwnAddress() const; -- cgit v1.2.3