summaryrefslogtreecommitdiffstats
path: root/src/TcpSocket.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-11-05 15:00:09 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-11-05 15:00:09 +0100
commit5c12d5b387e07203be79df7e4d526d124a53ad8a (patch)
treef5dde68268449c0d6b222df17aaafc99f33e586a /src/TcpSocket.cpp
parent3fa21bd39d9b9cb1b0b8d71e2cc98eebb98ad871 (diff)
downloaddabmux-5c12d5b387e07203be79df7e4d526d124a53ad8a.tar.gz
dabmux-5c12d5b387e07203be79df7e4d526d124a53ad8a.tar.bz2
dabmux-5c12d5b387e07203be79df7e4d526d124a53ad8a.zip
Do not use boost::optional for TcpSocket
Older boost versions require T to be copy-constructable in optional<T>. This is not the case for TcpSocket, which is only move-constructable. Fixes compilation on debian jessie
Diffstat (limited to 'src/TcpSocket.cpp')
-rw-r--r--src/TcpSocket.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/TcpSocket.cpp b/src/TcpSocket.cpp
index 433e5c1..6791286 100644
--- a/src/TcpSocket.cpp
+++ b/src/TcpSocket.cpp
@@ -116,6 +116,11 @@ TcpSocket::~TcpSocket()
close();
}
+bool TcpSocket::isValid()
+{
+ return m_sock != INVALID_SOCKET;
+}
+
ssize_t TcpSocket::recv(void* data, size_t size)
{
ssize_t ret = ::recv(m_sock, (char*)data, size, 0);
@@ -167,7 +172,7 @@ TcpSocket TcpSocket::accept()
}
}
-boost::optional<TcpSocket> TcpSocket::accept(int timeout_ms)
+TcpSocket TcpSocket::accept(int timeout_ms)
{
struct pollfd fds[1];
fds[0].fd = m_sock;
@@ -184,7 +189,8 @@ boost::optional<TcpSocket> TcpSocket::accept(int timeout_ms)
return accept();
}
else {
- return boost::none;
+ TcpSocket invalidsock(0, "");
+ return invalidsock;
}
}