summaryrefslogtreecommitdiffstats
path: root/src/UdpSocket.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-11-07 21:37:47 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-11-07 21:37:47 +0100
commit95b197a53c8314a68fd8cf73e495018844e7d708 (patch)
treed7a1f48c0c7f04bea34c9e19dc219195469df563 /src/UdpSocket.cpp
parent33e51f5996c02c6a6aee27b57d91d90e3f1db5a2 (diff)
parent21d8cacffc1201514b0e1143f8de60e754262291 (diff)
downloaddabmux-95b197a53c8314a68fd8cf73e495018844e7d708.tar.gz
dabmux-95b197a53c8314a68fd8cf73e495018844e7d708.tar.bz2
dabmux-95b197a53c8314a68fd8cf73e495018844e7d708.zip
Merge rework of inputs into 'next'
This breaks the non-blocking fifo inputs, as it seems nobody is using them. It restores some UDP functionality, not necessarily in the same way as before.
Diffstat (limited to 'src/UdpSocket.cpp')
-rw-r--r--src/UdpSocket.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/UdpSocket.cpp b/src/UdpSocket.cpp
index 020e3f5..ccdd7ed 100644
--- a/src/UdpSocket.cpp
+++ b/src/UdpSocket.cpp
@@ -37,19 +37,19 @@ using namespace std;
UdpSocket::UdpSocket() :
listenSocket(INVALID_SOCKET)
{
- init_sock(0, "");
+ reinit(0, "");
}
UdpSocket::UdpSocket(int port) :
listenSocket(INVALID_SOCKET)
{
- init_sock(port, "");
+ reinit(port, "");
}
UdpSocket::UdpSocket(int port, const std::string& name) :
listenSocket(INVALID_SOCKET)
{
- init_sock(port, name);
+ reinit(port, name);
}
@@ -67,7 +67,7 @@ int UdpSocket::setBlocking(bool block)
return 0;
}
-int UdpSocket::init_sock(int port, const std::string& name)
+int UdpSocket::reinit(int port, const std::string& name)
{
if (listenSocket != INVALID_SOCKET) {
::close(listenSocket);
@@ -98,6 +98,16 @@ int UdpSocket::init_sock(int port, const std::string& name)
return 0;
}
+int UdpSocket::close()
+{
+ if (listenSocket != INVALID_SOCKET) {
+ ::close(listenSocket);
+ }
+
+ listenSocket = INVALID_SOCKET;
+
+ return 0;
+}
UdpSocket::~UdpSocket()
{