summaryrefslogtreecommitdiffstats
path: root/tdecore/ksock.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-10-04 12:52:55 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-10-04 12:52:55 -0500
commit379f344bb31b16b7800442c86bd925ea47b99fa4 (patch)
tree10ad38bc2cadc40d3f19d7dd1d75cbd370ed7689 /tdecore/ksock.cpp
parent319f69a280df213c70a2bf18d999d29641d45fc7 (diff)
downloadtdelibs-379f344bb31b16b7800442c86bd925ea47b99fa4.tar.gz
tdelibs-379f344bb31b16b7800442c86bd925ea47b99fa4.zip
Modify bindAndListen to allow suppression of warnings when bind failures are expected as part of normal operation
This relates to Bug 1988
Diffstat (limited to 'tdecore/ksock.cpp')
-rw-r--r--tdecore/ksock.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/tdecore/ksock.cpp b/tdecore/ksock.cpp
index 96526463a..57bfc26d1 100644
--- a/tdecore/ksock.cpp
+++ b/tdecore/ksock.cpp
@@ -20,6 +20,8 @@
* Boston, MA 02110-1301, USA.
**/
+#define KSOCK_INTERNAL_C_COMPILATION 1
+
#include <config.h>
#include <sys/types.h>
@@ -312,7 +314,7 @@ bool TDEServerSocket::init( const char *_path )
d->ks = ks;
if (d->bind)
- return bindAndListen();
+ return bindAndListen(false);
return true;
}
@@ -326,11 +328,11 @@ bool TDEServerSocket::init( unsigned short int _port )
d->ks = ks;
if (d->bind)
- return bindAndListen();
+ return bindAndListen(false);
return true;
}
-bool TDEServerSocket::bindAndListen()
+bool TDEServerSocket::bindAndListen(bool suppressFailureMessages)
{
if (d == NULL || d->ks == NULL)
return false;
@@ -339,7 +341,10 @@ bool TDEServerSocket::bindAndListen()
int ret = d->ks->listen( SOMAXCONN );
if (ret < 0)
{
- kdWarning(170) << "Error listening on socket: " << ret << "\n";
+ if (!suppressFailureMessages)
+ {
+ kdWarning(170) << "Error listening on socket for port " << d->ks->port() << ": " << ret << "\n";
+ }
delete d->ks;
d->ks = NULL;
sock = -1;
@@ -432,4 +437,10 @@ TDEServerSocket::~TDEServerSocket()
// ::close( sock );
}
+// DEPRECATED
+bool TDEServerSocket::bindAndListen()
+{
+ return bindAndListen(false);
+}
+
#include "ksock.moc"