summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorentin Jabot <corentinjabot@gmail.com>2013-01-14 19:25:31 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-06 00:11:20 +0100
commit88918abddeb323340c4a49dda035898a740373da (patch)
tree3b3477fb4f803d8b6d22890b662046c868e93fc8
parent53de2934337d96ba80732e16ad907f98663bec91 (diff)
Make QLocalSocket::open set an error when already connected
When attempting to connect a tcp-based QLocalSocket while it was already connected, the open() (and connectToServer()) method failed silently. That behavior was not helpful and inconsistent with the windows and unix implementations. So an error is now set and error() is emitted Change-Id: I544e81f0a303dd6d5b1869287df860878a8a06c6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/network/socket/qlocalsocket_tcp.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp
index cf109c2b2f..edde5a4687 100644
--- a/src/network/socket/qlocalsocket_tcp.cpp
+++ b/src/network/socket/qlocalsocket_tcp.cpp
@@ -218,6 +218,8 @@ bool QLocalSocket::open(OpenMode openMode)
{
Q_D(QLocalSocket);
if (state() == ConnectedState || state() == ConnectingState) {
+ setErrorString(tr("Trying to connect while connection is in progress"));
+ emit error(QLocalSocket::OperationError);
return false;
}