From 88918abddeb323340c4a49dda035898a740373da Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Mon, 14 Jan 2013 19:25:31 +0100 Subject: 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 --- src/network/socket/qlocalsocket_tcp.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/network/socket') 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; } -- cgit v1.2.3