aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CommonLibs/Sockets.cpp6
-rw-r--r--CommonLibs/Sockets.h6
2 files changed, 12 insertions, 0 deletions
diff --git a/CommonLibs/Sockets.cpp b/CommonLibs/Sockets.cpp
index dd7527c..5af82ef 100644
--- a/CommonLibs/Sockets.cpp
+++ b/CommonLibs/Sockets.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2008, 2010 Free Software Foundation, Inc.
+* Copyright 2013 Alexander Chemeris <Alexander.Chemeris@fairwaves.ru>
*
*
* This software is distributed under the terms of the GNU Affero Public License.
@@ -129,6 +130,11 @@ void DatagramSocket::close()
::close(mSocketFD);
}
+void DatagramSocket::shutdown()
+{
+ ::shutdown(mSocketFD, SHUT_RDWR);
+}
+
DatagramSocket::~DatagramSocket()
{
diff --git a/CommonLibs/Sockets.h b/CommonLibs/Sockets.h
index c79f79a..b5219c6 100644
--- a/CommonLibs/Sockets.h
+++ b/CommonLibs/Sockets.h
@@ -1,5 +1,6 @@
/*
* Copyright 2008, 2010 Free Software Foundation, Inc.
+* Copyright 2013 Alexander Chemeris <Alexander.Chemeris@fairwaves.ru>
*
* This software is distributed under the terms of the GNU Affero Public License.
* See the COPYING file in the main directory for details.
@@ -134,6 +135,11 @@ public:
/** Close the socket. */
void close();
+ /** Shutdown the socket without destroying the descriptor
+ * Use this to interrupt blocking read()
+ */
+ void shutdown();
+
};