qlocalsocket_unix.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/socket/qlocalsocket_unix.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15-
16-
17-
18QLocalSocketPrivate::QLocalSocketPrivate() : QIODevicePrivate(),-
19 delayConnect(0),-
20 connectTimer(0),-
21 connectingSocket(-1),-
22 connectingOpenMode(0),-
23 state(QLocalSocket::UnconnectedState)-
24{-
25}
executed 165 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
165
26-
27void QLocalSocketPrivate::init()-
28{-
29 QLocalSocket * const q = q_func();-
30-
31 q->connect(&unixSocket, qFlagLocation("2""aboutToClose()" "\0" __FILE__ ":" "78"), q, qFlagLocation("2""aboutToClose()" "\0" __FILE__ ":" "78"));-
32 q->connect(&unixSocket, qFlagLocation("2""bytesWritten(qint64)" "\0" __FILE__ ":" "79"),-
33 q, qFlagLocation("2""bytesWritten(qint64)" "\0" __FILE__ ":" "80"));-
34 q->connect(&unixSocket, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "81"), q, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "81"));-
35-
36 q->connect(&unixSocket, qFlagLocation("2""connected()" "\0" __FILE__ ":" "83"), q, qFlagLocation("2""connected()" "\0" __FILE__ ":" "83"));-
37 q->connect(&unixSocket, qFlagLocation("2""disconnected()" "\0" __FILE__ ":" "84"), q, qFlagLocation("2""disconnected()" "\0" __FILE__ ":" "84"));-
38 q->connect(&unixSocket, qFlagLocation("2""stateChanged(QAbstractSocket::SocketState)" "\0" __FILE__ ":" "85"),-
39 q, qFlagLocation("1""_q_stateChanged(QAbstractSocket::SocketState)" "\0" __FILE__ ":" "86"));-
40 q->connect(&unixSocket, qFlagLocation("2""error(QAbstractSocket::SocketError)" "\0" __FILE__ ":" "87"),-
41 q, qFlagLocation("1""_q_error(QAbstractSocket::SocketError)" "\0" __FILE__ ":" "88"));-
42 q->connect(&unixSocket, qFlagLocation("2""readChannelFinished()" "\0" __FILE__ ":" "89"), q, qFlagLocation("2""readChannelFinished()" "\0" __FILE__ ":" "89"));-
43 unixSocket.setParent(q);-
44}
executed 165 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
165
45-
46void QLocalSocketPrivate::_q_error(QAbstractSocket::SocketError socketError)-
47{-
48 QLocalSocket * const q = q_func();-
49 QString function = QLatin1String("QLocalSocket");-
50 QLocalSocket::LocalSocketError error = (QLocalSocket::LocalSocketError)socketError;-
51 QString errorString = generateErrorString(error, function);-
52 q->setErrorString(errorString);-
53 q->error(error);-
54}
executed 25 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
25
55-
56void QLocalSocketPrivate::_q_stateChanged(QAbstractSocket::SocketState newState)-
57{-
58 QLocalSocket * const q = q_func();-
59 QLocalSocket::LocalSocketState currentState = state;-
60 switch(newState) {-
61 case
executed 157 times by 3 tests: case QAbstractSocket::UnconnectedState:
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
QAbstractSocket::UnconnectedState:
executed 157 times by 3 tests: case QAbstractSocket::UnconnectedState:
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
157
62 state = QLocalSocket::UnconnectedState;-
63 serverName.clear();-
64 fullServerName.clear();-
65 break;
executed 157 times by 3 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
157
66 case
never executed: case QAbstractSocket::ConnectingState:
QAbstractSocket::ConnectingState:
never executed: case QAbstractSocket::ConnectingState:
0
67 state = QLocalSocket::ConnectingState;-
68 break;
never executed: break;
0
69 case
executed 158 times by 3 tests: case QAbstractSocket::ConnectedState:
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
QAbstractSocket::ConnectedState:
executed 158 times by 3 tests: case QAbstractSocket::ConnectedState:
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
158
70 state = QLocalSocket::ConnectedState;-
71 break;
executed 158 times by 3 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
158
72 case
executed 154 times by 3 tests: case QAbstractSocket::ClosingState:
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
QAbstractSocket::ClosingState:
executed 154 times by 3 tests: case QAbstractSocket::ClosingState:
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
154
73 state = QLocalSocket::ClosingState;-
74 break;
executed 154 times by 3 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
154
75 default
never executed: default:
:
never executed: default:
0
76-
77-
78-
79 return;
never executed: return;
0
80 }-
81 if (currentState != state
currentState != stateDescription
TRUEevaluated 392 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
FALSEevaluated 77 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
)
77-392
82 q->stateChanged(state);
executed 392 times by 3 tests: q->stateChanged(state);
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
392
83}
executed 469 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
469
84-
85QString QLocalSocketPrivate::generateErrorString(QLocalSocket::LocalSocketError error, const QString &function) const-
86{-
87 QString errorString;-
88 switch (error) {-
89 case
never executed: case QLocalSocket::ConnectionRefusedError:
QLocalSocket::ConnectionRefusedError:
never executed: case QLocalSocket::ConnectionRefusedError:
0
90 errorString = QLocalSocket::tr("%1: Connection refused").arg(function);-
91 break;
never executed: break;
0
92 case
executed 19 times by 3 tests: case QLocalSocket::PeerClosedError:
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
QLocalSocket::PeerClosedError:
executed 19 times by 3 tests: case QLocalSocket::PeerClosedError:
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
19
93 errorString = QLocalSocket::tr("%1: Remote closed").arg(function);-
94 break;
executed 19 times by 3 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
19
95 case
executed 8 times by 1 test: case QLocalSocket::ServerNotFoundError:
Executed by:
  • tst_qlocalsocket - unknown status
QLocalSocket::ServerNotFoundError:
executed 8 times by 1 test: case QLocalSocket::ServerNotFoundError:
Executed by:
  • tst_qlocalsocket - unknown status
8
96 errorString = QLocalSocket::tr("%1: Invalid name").arg(function);-
97 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_qlocalsocket - unknown status
8
98 case
never executed: case QLocalSocket::SocketAccessError:
QLocalSocket::SocketAccessError:
never executed: case QLocalSocket::SocketAccessError:
0
99 errorString = QLocalSocket::tr("%1: Socket access error").arg(function);-
100 break;
never executed: break;
0
101 case
never executed: case QLocalSocket::SocketResourceError:
QLocalSocket::SocketResourceError:
never executed: case QLocalSocket::SocketResourceError:
0
102 errorString = QLocalSocket::tr("%1: Socket resource error").arg(function);-
103 break;
never executed: break;
0
104 case
executed 6 times by 1 test: case QLocalSocket::SocketTimeoutError:
Executed by:
  • tst_qlocalsocket - unknown status
QLocalSocket::SocketTimeoutError:
executed 6 times by 1 test: case QLocalSocket::SocketTimeoutError:
Executed by:
  • tst_qlocalsocket - unknown status
6
105 errorString = QLocalSocket::tr("%1: Socket operation timed out").arg(function);-
106 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_qlocalsocket - unknown status
6
107 case
never executed: case QLocalSocket::DatagramTooLargeError:
QLocalSocket::DatagramTooLargeError:
never executed: case QLocalSocket::DatagramTooLargeError:
0
108 errorString = QLocalSocket::tr("%1: Datagram too large").arg(function);-
109 break;
never executed: break;
0
110 case
never executed: case QLocalSocket::ConnectionError:
QLocalSocket::ConnectionError:
never executed: case QLocalSocket::ConnectionError:
0
111 errorString = QLocalSocket::tr("%1: Connection error").arg(function);-
112 break;
never executed: break;
0
113 case
never executed: case QLocalSocket::UnsupportedSocketOperationError:
QLocalSocket::UnsupportedSocketOperationError:
never executed: case QLocalSocket::UnsupportedSocketOperationError:
0
114 errorString = QLocalSocket::tr("%1: The socket operation is not supported").arg(function);-
115 break;
never executed: break;
0
116 case
never executed: case QLocalSocket::OperationError:
QLocalSocket::OperationError:
never executed: case QLocalSocket::OperationError:
0
117 errorString = QLocalSocket::tr("%1: Operation not permitted when socket is in this state").arg(function);-
118 break;
never executed: break;
0
119 case
never executed: case QLocalSocket::UnknownSocketError:
QLocalSocket::UnknownSocketError:
never executed: case QLocalSocket::UnknownSocketError:
0
120 default
never executed: default:
:
never executed: default:
0
121 errorString = QLocalSocket::tr("%1: Unknown error %2").arg(function).arg((*__errno_location ()));-
122 }
never executed: end of block
0
123 return
executed 33 times by 3 tests: return errorString;
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
errorString;
executed 33 times by 3 tests: return errorString;
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
33
124}-
125-
126void QLocalSocketPrivate::errorOccurred(QLocalSocket::LocalSocketError error, const QString &function)-
127{-
128 QLocalSocket * const q = q_func();-
129 switch (error) {-
130 case
never executed: case QLocalSocket::ConnectionRefusedError:
QLocalSocket::ConnectionRefusedError:
never executed: case QLocalSocket::ConnectionRefusedError:
0
131 unixSocket.setSocketError(QAbstractSocket::ConnectionRefusedError);-
132 break;
never executed: break;
0
133 case
never executed: case QLocalSocket::PeerClosedError:
QLocalSocket::PeerClosedError:
never executed: case QLocalSocket::PeerClosedError:
0
134 unixSocket.setSocketError(QAbstractSocket::RemoteHostClosedError);-
135 break;
never executed: break;
0
136 case
executed 8 times by 1 test: case QLocalSocket::ServerNotFoundError:
Executed by:
  • tst_qlocalsocket - unknown status
QLocalSocket::ServerNotFoundError:
executed 8 times by 1 test: case QLocalSocket::ServerNotFoundError:
Executed by:
  • tst_qlocalsocket - unknown status
8
137 unixSocket.setSocketError(QAbstractSocket::HostNotFoundError);-
138 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_qlocalsocket - unknown status
8
139 case
never executed: case QLocalSocket::SocketAccessError:
QLocalSocket::SocketAccessError:
never executed: case QLocalSocket::SocketAccessError:
0
140 unixSocket.setSocketError(QAbstractSocket::SocketAccessError);-
141 break;
never executed: break;
0
142 case
never executed: case QLocalSocket::SocketResourceError:
QLocalSocket::SocketResourceError:
never executed: case QLocalSocket::SocketResourceError:
0
143 unixSocket.setSocketError(QAbstractSocket::SocketResourceError);-
144 break;
never executed: break;
0
145 case
never executed: case QLocalSocket::SocketTimeoutError:
QLocalSocket::SocketTimeoutError:
never executed: case QLocalSocket::SocketTimeoutError:
0
146 unixSocket.setSocketError(QAbstractSocket::SocketTimeoutError);-
147 break;
never executed: break;
0
148 case
never executed: case QLocalSocket::DatagramTooLargeError:
QLocalSocket::DatagramTooLargeError:
never executed: case QLocalSocket::DatagramTooLargeError:
0
149 unixSocket.setSocketError(QAbstractSocket::DatagramTooLargeError);-
150 break;
never executed: break;
0
151 case
never executed: case QLocalSocket::ConnectionError:
QLocalSocket::ConnectionError:
never executed: case QLocalSocket::ConnectionError:
0
152 unixSocket.setSocketError(QAbstractSocket::NetworkError);-
153 break;
never executed: break;
0
154 case
never executed: case QLocalSocket::UnsupportedSocketOperationError:
QLocalSocket::UnsupportedSocketOperationError:
never executed: case QLocalSocket::UnsupportedSocketOperationError:
0
155 unixSocket.setSocketError(QAbstractSocket::UnsupportedSocketOperationError);-
156 break;
never executed: break;
0
157 case
never executed: case QLocalSocket::UnknownSocketError:
QLocalSocket::UnknownSocketError:
never executed: case QLocalSocket::UnknownSocketError:
0
158 default
never executed: default:
:
never executed: default:
0
159 unixSocket.setSocketError(QAbstractSocket::UnknownSocketError);-
160 }
never executed: end of block
0
161-
162 QString errorString = generateErrorString(error, function);-
163 q->setErrorString(errorString);-
164 q->error(error);-
165-
166-
167 unixSocket.setSocketState(QAbstractSocket::UnconnectedState);-
168 bool stateChanged = (state != QLocalSocket::UnconnectedState);-
169 state = QLocalSocket::UnconnectedState;-
170 q->close();-
171 if (stateChanged
stateChangedDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
FALSEnever evaluated
)
0-8
172 q-> stateChanged(state);
executed 8 times by 1 test: q-> stateChanged(state);
Executed by:
  • tst_qlocalsocket - unknown status
8
173}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qlocalsocket - unknown status
8
174-
175void QLocalSocket::connectToServer(OpenMode openMode)-
176{-
177 QLocalSocketPrivate * const d = d_func();-
178 if (state() == ConnectedState
state() == ConnectedStateDescription
TRUEnever evaluated
FALSEevaluated 89 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
|| state() == ConnectingState
state() == ConnectingStateDescription
TRUEnever evaluated
FALSEevaluated 89 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
) {
0-89
179 QString errorString = d->generateErrorString(QLocalSocket::OperationError, QLatin1String("QLocalSocket::connectToserver"));-
180 setErrorString(errorString);-
181 error(QLocalSocket::OperationError);-
182 return;
never executed: return;
0
183 }-
184-
185 d->errorString.clear();-
186 d->unixSocket.setSocketState(QAbstractSocket::ConnectingState);-
187 d->state = ConnectingState;-
188 stateChanged(d->state);-
189-
190 if (d->serverName.isEmpty()
d->serverName.isEmpty()Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
FALSEevaluated 82 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
) {
7-82
191 d->errorOccurred(ServerNotFoundError,-
192 QLatin1String("QLocalSocket::connectToServer"));-
193 return;
executed 7 times by 1 test: return;
Executed by:
  • tst_qlocalsocket - unknown status
7
194 }-
195-
196-
197 if (-
-1 == (d->conn...AM, 0, 04000))Description
TRUEnever evaluated
FALSEevaluated 82 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
1 == (d->connectingSocket = qt_safe_socket(1, SOCK_STREAM, 0, 04000))
-1 == (d->conn...AM, 0, 04000))Description
TRUEnever evaluated
FALSEevaluated 82 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
) {
0-82
198 d->errorOccurred(UnsupportedSocketOperationError,-
199 QLatin1String("QLocalSocket::connectToServer"));-
200 return;
never executed: return;
0
201 }-
202-
203-
204 d->connectingName = d->serverName;-
205 d->connectingOpenMode = openMode;-
206 d->_q_connectToSocket();-
207 return;
executed 82 times by 2 tests: return;
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
82
208}-
209void QLocalSocketPrivate::_q_connectToSocket()-
210{-
211 QLocalSocket * const q = q_func();-
212 QString connectingPathName;-
213-
214-
215 if (connectingName.startsWith(QLatin1Char('/'))
connectingName...tin1Char('/'))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
FALSEevaluated 81 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
) {
1-81
216 connectingPathName = connectingName;-
217 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_qlocalsocket - unknown status
else {
1
218 connectingPathName = QDir::tempPath();-
219 connectingPathName += QLatin1Char('/') + connectingName;-
220 }
executed 81 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
81
221-
222 const QByteArray encodedConnectingPathName = QFile::encodeName(connectingPathName);-
223 struct sockaddr_un name;-
224 name.sun_family = 1;-
225 if (sizeof(name.sun_path) < (uint)encodedConnectingPathName.size() + 1
sizeof(name.su...ame.size() + 1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
FALSEevaluated 81 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
) {
1-81
226 QString function = QLatin1String("QLocalSocket::connectToServer");-
227 errorOccurred(QLocalSocket::ServerNotFoundError, function);-
228 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_qlocalsocket - unknown status
1
229 }-
230 ::memcpy(name.sun_path, encodedConnectingPathName.constData(),-
231 encodedConnectingPathName.size() + 1);-
232 if (-
-1 == qt_safe_... sizeof(name))Description
TRUEnever evaluated
FALSEevaluated 81 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
1 == qt_safe_connect(connectingSocket, (struct sockaddr *)&name, sizeof(name))
-1 == qt_safe_... sizeof(name))Description
TRUEnever evaluated
FALSEevaluated 81 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
) {
0-81
233 QString function = QLatin1String("QLocalSocket::connectToServer");-
234 switch ((*__errno_location ()))-
235 {-
236 case
never executed: case 22:
22:
never executed: case 22:
0
237 case
never executed: case 111:
111:
never executed: case 111:
0
238 errorOccurred(QLocalSocket::ConnectionRefusedError, function);-
239 break;
never executed: break;
0
240 case
never executed: case 2:
2:
never executed: case 2:
0
241 errorOccurred(QLocalSocket::ServerNotFoundError, function);-
242 break;
never executed: break;
0
243 case
never executed: case 13:
13:
never executed: case 13:
0
244 case
never executed: case 1:
1:
never executed: case 1:
0
245 errorOccurred(QLocalSocket::SocketAccessError, function);-
246 break;
never executed: break;
0
247 case
never executed: case 110:
110:
never executed: case 110:
0
248 errorOccurred(QLocalSocket::SocketTimeoutError, function);-
249 break;
never executed: break;
0
250 case
never executed: case 11:
11:
never executed: case 11:
0
251-
252 if (!delayConnect
!delayConnectDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
253 delayConnect = new QSocketNotifier(connectingSocket, QSocketNotifier::Write, q);-
254 q->connect(delayConnect, qFlagLocation("2""activated(int)" "\0" __FILE__ ":" "309"), q, qFlagLocation("1""_q_connectToSocket()" "\0" __FILE__ ":" "309"));-
255 }
never executed: end of block
0
256 if (!connectTimer
!connectTimerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
257 connectTimer = new QTimer(q);-
258 q->connect(connectTimer, qFlagLocation("2""timeout()" "\0" __FILE__ ":" "313"),-
259 q, qFlagLocation("1""_q_abortConnectionAttempt()" "\0" __FILE__ ":" "314"),-
260 Qt::DirectConnection);-
261 connectTimer->start(30000);-
262 }
never executed: end of block
0
263 delayConnect->setEnabled(true);-
264 break;
never executed: break;
0
265 default
never executed: default:
:
never executed: default:
0
266 errorOccurred(QLocalSocket::UnknownSocketError, function);-
267 }
never executed: end of block
0
268 return;
never executed: return;
0
269 }-
270-
271-
272 cancelDelayedConnect();-
273-
274 serverName = connectingName;-
275 fullServerName = connectingPathName;-
276 if (unixSocket.setSocketDescriptor(connectingSocket,
unixSocket.set...ctingOpenMode)Description
TRUEevaluated 81 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
FALSEnever evaluated
0-81
277 QAbstractSocket::ConnectedState, connectingOpenMode)
unixSocket.set...ctingOpenMode)Description
TRUEevaluated 81 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
FALSEnever evaluated
) {
0-81
278 q->QIODevice::open(connectingOpenMode | QIODevice::Unbuffered);-
279 q-> connected();-
280 }
executed 81 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
else {
81
281 QString function = QLatin1String("QLocalSocket::connectToServer");-
282 errorOccurred(QLocalSocket::UnknownSocketError, function);-
283 }
never executed: end of block
0
284 connectingSocket = -1;-
285 connectingName.clear();-
286 connectingOpenMode = 0;-
287}
executed 81 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
81
288-
289bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor,-
290 LocalSocketState socketState, OpenMode openMode)-
291{-
292 QLocalSocketPrivate * const d = d_func();-
293 QAbstractSocket::SocketState newSocketState = QAbstractSocket::UnconnectedState;-
294 switch (socketState) {-
295 case
executed 1 time by 1 test: case ConnectingState:
Executed by:
  • tst_qlocalsocket - unknown status
ConnectingState:
executed 1 time by 1 test: case ConnectingState:
Executed by:
  • tst_qlocalsocket - unknown status
1
296 newSocketState = QAbstractSocket::ConnectingState;-
297 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_qlocalsocket - unknown status
1
298 case
executed 77 times by 3 tests: case ConnectedState:
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
ConnectedState:
executed 77 times by 3 tests: case ConnectedState:
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
77
299 newSocketState = QAbstractSocket::ConnectedState;-
300 break;
executed 77 times by 3 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
77
301 case
never executed: case ClosingState:
ClosingState:
never executed: case ClosingState:
0
302 newSocketState = QAbstractSocket::ClosingState;-
303 break;
never executed: break;
0
304 case
never executed: case UnconnectedState:
UnconnectedState:
never executed: case UnconnectedState:
0
305 newSocketState = QAbstractSocket::UnconnectedState;-
306 break;
never executed: break;
0
307 }-
308 QIODevice::open(openMode);-
309 d->state = socketState;-
310 return
executed 78 times by 3 tests: return d->unixSocket.setSocketDescriptor(socketDescriptor, newSocketState, openMode);
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
d->unixSocket.setSocketDescriptor(socketDescriptor,
executed 78 times by 3 tests: return d->unixSocket.setSocketDescriptor(socketDescriptor, newSocketState, openMode);
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
78
311 newSocketState, openMode);
executed 78 times by 3 tests: return d->unixSocket.setSocketDescriptor(socketDescriptor, newSocketState, openMode);
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
78
312}-
313-
314void QLocalSocketPrivate::_q_abortConnectionAttempt()-
315{-
316 QLocalSocket * const q = q_func();-
317 q->close();-
318}
never executed: end of block
0
319-
320void QLocalSocketPrivate::cancelDelayedConnect()-
321{-
322 if (delayConnect
delayConnectDescription
TRUEnever evaluated
FALSEevaluated 305 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
) {
0-305
323 delayConnect->setEnabled(false);-
324 delete delayConnect;-
325 delayConnect = 0;-
326 connectTimer->stop();-
327 delete connectTimer;-
328 connectTimer = 0;-
329 }
never executed: end of block
0
330}
executed 305 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
305
331-
332qintptr QLocalSocket::socketDescriptor() const-
333{-
334 const QLocalSocketPrivate * const d = d_func();-
335 return
executed 1 time by 1 test: return d->unixSocket.socketDescriptor();
Executed by:
  • tst_qlocalsocket - unknown status
d->unixSocket.socketDescriptor();
executed 1 time by 1 test: return d->unixSocket.socketDescriptor();
Executed by:
  • tst_qlocalsocket - unknown status
1
336}-
337-
338qint64 QLocalSocket::readData(char *data, qint64 c)-
339{-
340 QLocalSocketPrivate * const d = d_func();-
341 return
executed 4330 times by 2 tests: return d->unixSocket.read(data, c);
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
d->unixSocket.read(data, c);
executed 4330 times by 2 tests: return d->unixSocket.read(data, c);
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
4330
342}-
343-
344qint64 QLocalSocket::writeData(const char *data, qint64 c)-
345{-
346 QLocalSocketPrivate * const d = d_func();-
347 return
executed 2573 times by 2 tests: return d->unixSocket.writeData(data, c);
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
d->unixSocket.writeData(data, c);
executed 2573 times by 2 tests: return d->unixSocket.writeData(data, c);
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
2573
348}-
349-
350void QLocalSocket::abort()-
351{-
352 QLocalSocketPrivate * const d = d_func();-
353 d->unixSocket.abort();-
354}
executed 5 times by 1 test: end of block
Executed by:
  • tst_qlocalsocket - unknown status
5
355-
356qint64 QLocalSocket::bytesAvailable() const-
357{-
358 const QLocalSocketPrivate * const d = d_func();-
359 return
executed 5112 times by 2 tests: return QIODevice::bytesAvailable() + d->unixSocket.bytesAvailable();
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
QIODevice::bytesAvailable() + d->unixSocket.bytesAvailable();
executed 5112 times by 2 tests: return QIODevice::bytesAvailable() + d->unixSocket.bytesAvailable();
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
5112
360}-
361-
362qint64 QLocalSocket::bytesToWrite() const-
363{-
364 const QLocalSocketPrivate * const d = d_func();-
365 return
executed 4018 times by 1 test: return d->unixSocket.bytesToWrite();
Executed by:
  • tst_qlocalsocket - unknown status
d->unixSocket.bytesToWrite();
executed 4018 times by 1 test: return d->unixSocket.bytesToWrite();
Executed by:
  • tst_qlocalsocket - unknown status
4018
366}-
367-
368bool QLocalSocket::canReadLine() const-
369{-
370 const QLocalSocketPrivate * const d = d_func();-
371 return
executed 14 times by 1 test: return QIODevice::canReadLine() || d->unixSocket.canReadLine();
Executed by:
  • tst_qlocalsocket - unknown status
QIODevice::canReadLine() || d->unixSocket.canReadLine();
executed 14 times by 1 test: return QIODevice::canReadLine() || d->unixSocket.canReadLine();
Executed by:
  • tst_qlocalsocket - unknown status
14
372}-
373-
374void QLocalSocket::close()-
375{-
376 QLocalSocketPrivate * const d = d_func();-
377 d->unixSocket.close();-
378 d->cancelDelayedConnect();-
379 if (d->connectingSocket != -1
d->connectingSocket != -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
FALSEevaluated 223 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
)
1-223
380 ::
executed 1 time by 1 test: ::close(d->connectingSocket);
Executed by:
  • tst_qlocalsocket - unknown status
close(d->connectingSocket);
executed 1 time by 1 test: ::close(d->connectingSocket);
Executed by:
  • tst_qlocalsocket - unknown status
1
381 d->connectingSocket = -1;-
382 d->connectingName.clear();-
383 d->connectingOpenMode = 0;-
384 d->serverName.clear();-
385 d->fullServerName.clear();-
386 QIODevice::close();-
387}
executed 224 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
224
388-
389bool QLocalSocket::waitForBytesWritten(int msecs)-
390{-
391 QLocalSocketPrivate * const d = d_func();-
392 return
executed 2042 times by 1 test: return d->unixSocket.waitForBytesWritten(msecs);
Executed by:
  • tst_qlocalsocket - unknown status
d->unixSocket.waitForBytesWritten(msecs);
executed 2042 times by 1 test: return d->unixSocket.waitForBytesWritten(msecs);
Executed by:
  • tst_qlocalsocket - unknown status
2042
393}-
394-
395bool QLocalSocket::flush()-
396{-
397 QLocalSocketPrivate * const d = d_func();-
398 return
executed 17 times by 1 test: return d->unixSocket.flush();
Executed by:
  • tst_qlocalsocket - unknown status
d->unixSocket.flush();
executed 17 times by 1 test: return d->unixSocket.flush();
Executed by:
  • tst_qlocalsocket - unknown status
17
399}-
400-
401void QLocalSocket::disconnectFromServer()-
402{-
403 QLocalSocketPrivate * const d = d_func();-
404 d->unixSocket.disconnectFromHost();-
405}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qlocalsocket - unknown status
6
406-
407QLocalSocket::LocalSocketError QLocalSocket::error() const-
408{-
409 const QLocalSocketPrivate * const d = d_func();-
410 switch (d->unixSocket.error()) {-
411 case
never executed: case QAbstractSocket::ConnectionRefusedError:
QAbstractSocket::ConnectionRefusedError:
never executed: case QAbstractSocket::ConnectionRefusedError:
0
412 return
never executed: return QLocalSocket::ConnectionRefusedError;
QLocalSocket::ConnectionRefusedError;
never executed: return QLocalSocket::ConnectionRefusedError;
0
413 case
executed 1 time by 1 test: case QAbstractSocket::RemoteHostClosedError:
Executed by:
  • tst_qlocalsocket - unknown status
QAbstractSocket::RemoteHostClosedError:
executed 1 time by 1 test: case QAbstractSocket::RemoteHostClosedError:
Executed by:
  • tst_qlocalsocket - unknown status
1
414 return
executed 1 time by 1 test: return QLocalSocket::PeerClosedError;
Executed by:
  • tst_qlocalsocket - unknown status
QLocalSocket::PeerClosedError;
executed 1 time by 1 test: return QLocalSocket::PeerClosedError;
Executed by:
  • tst_qlocalsocket - unknown status
1
415 case
executed 14 times by 1 test: case QAbstractSocket::HostNotFoundError:
Executed by:
  • tst_qlocalsocket - unknown status
QAbstractSocket::HostNotFoundError:
executed 14 times by 1 test: case QAbstractSocket::HostNotFoundError:
Executed by:
  • tst_qlocalsocket - unknown status
14
416 return
executed 14 times by 1 test: return QLocalSocket::ServerNotFoundError;
Executed by:
  • tst_qlocalsocket - unknown status
QLocalSocket::ServerNotFoundError;
executed 14 times by 1 test: return QLocalSocket::ServerNotFoundError;
Executed by:
  • tst_qlocalsocket - unknown status
14
417 case
never executed: case QAbstractSocket::SocketAccessError:
QAbstractSocket::SocketAccessError:
never executed: case QAbstractSocket::SocketAccessError:
0
418 return
never executed: return QLocalSocket::SocketAccessError;
QLocalSocket::SocketAccessError;
never executed: return QLocalSocket::SocketAccessError;
0
419 case
never executed: case QAbstractSocket::SocketResourceError:
QAbstractSocket::SocketResourceError:
never executed: case QAbstractSocket::SocketResourceError:
0
420 return
never executed: return QLocalSocket::SocketResourceError;
QLocalSocket::SocketResourceError;
never executed: return QLocalSocket::SocketResourceError;
0
421 case
executed 6 times by 1 test: case QAbstractSocket::SocketTimeoutError:
Executed by:
  • tst_qlocalsocket - unknown status
QAbstractSocket::SocketTimeoutError:
executed 6 times by 1 test: case QAbstractSocket::SocketTimeoutError:
Executed by:
  • tst_qlocalsocket - unknown status
6
422 return
executed 6 times by 1 test: return QLocalSocket::SocketTimeoutError;
Executed by:
  • tst_qlocalsocket - unknown status
QLocalSocket::SocketTimeoutError;
executed 6 times by 1 test: return QLocalSocket::SocketTimeoutError;
Executed by:
  • tst_qlocalsocket - unknown status
6
423 case
never executed: case QAbstractSocket::DatagramTooLargeError:
QAbstractSocket::DatagramTooLargeError:
never executed: case QAbstractSocket::DatagramTooLargeError:
0
424 return
never executed: return QLocalSocket::DatagramTooLargeError;
QLocalSocket::DatagramTooLargeError;
never executed: return QLocalSocket::DatagramTooLargeError;
0
425 case
never executed: case QAbstractSocket::NetworkError:
QAbstractSocket::NetworkError:
never executed: case QAbstractSocket::NetworkError:
0
426 return
never executed: return QLocalSocket::ConnectionError;
QLocalSocket::ConnectionError;
never executed: return QLocalSocket::ConnectionError;
0
427 case
never executed: case QAbstractSocket::UnsupportedSocketOperationError:
QAbstractSocket::UnsupportedSocketOperationError:
never executed: case QAbstractSocket::UnsupportedSocketOperationError:
0
428 return
never executed: return QLocalSocket::UnsupportedSocketOperationError;
QLocalSocket::UnsupportedSocketOperationError;
never executed: return QLocalSocket::UnsupportedSocketOperationError;
0
429 case
executed 7 times by 1 test: case QAbstractSocket::UnknownSocketError:
Executed by:
  • tst_qlocalsocket - unknown status
QAbstractSocket::UnknownSocketError:
executed 7 times by 1 test: case QAbstractSocket::UnknownSocketError:
Executed by:
  • tst_qlocalsocket - unknown status
7
430 return
executed 7 times by 1 test: return QLocalSocket::UnknownSocketError;
Executed by:
  • tst_qlocalsocket - unknown status
QLocalSocket::UnknownSocketError;
executed 7 times by 1 test: return QLocalSocket::UnknownSocketError;
Executed by:
  • tst_qlocalsocket - unknown status
7
431 default
never executed: default:
:
never executed: default:
0
432-
433-
434-
435 break;
never executed: break;
0
436 }-
437 return
never executed: return UnknownSocketError;
UnknownSocketError;
never executed: return UnknownSocketError;
0
438}-
439-
440bool QLocalSocket::isValid() const-
441{-
442 const QLocalSocketPrivate * const d = d_func();-
443 return
executed 20 times by 1 test: return d->unixSocket.isValid();
Executed by:
  • tst_qlocalsocket - unknown status
d->unixSocket.isValid();
executed 20 times by 1 test: return d->unixSocket.isValid();
Executed by:
  • tst_qlocalsocket - unknown status
20
444}-
445-
446qint64 QLocalSocket::readBufferSize() const-
447{-
448 const QLocalSocketPrivate * const d = d_func();-
449 return
executed 14 times by 1 test: return d->unixSocket.readBufferSize();
Executed by:
  • tst_qlocalsocket - unknown status
d->unixSocket.readBufferSize();
executed 14 times by 1 test: return d->unixSocket.readBufferSize();
Executed by:
  • tst_qlocalsocket - unknown status
14
450}-
451-
452void QLocalSocket::setReadBufferSize(qint64 size)-
453{-
454 QLocalSocketPrivate * const d = d_func();-
455 d->unixSocket.setReadBufferSize(size);-
456}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qlocalsocket - unknown status
2
457-
458bool QLocalSocket::waitForConnected(int msec)-
459{-
460 QLocalSocketPrivate * const d = d_func();-
461-
462 if (state() != ConnectingState
state() != ConnectingStateDescription
TRUEevaluated 78 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
FALSEnever evaluated
)
0-78
463 return
executed 78 times by 2 tests: return (state() == ConnectedState);
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
(state() == ConnectedState);
executed 78 times by 2 tests: return (state() == ConnectedState);
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
78
464-
465 QElapsedTimer timer;-
466 timer.start();-
467-
468 pollfd pfd = qt_make_pollfd(d->connectingSocket, 0x001);-
469-
470 do {-
471 const int timeout = (
(msec > 0)Description
TRUEnever evaluated
FALSEnever evaluated
msec > 0)
(msec > 0)Description
TRUEnever evaluated
FALSEnever evaluated
? qMax(msec - timer.elapsed(), static_cast<long long>(0LL)) : msec;
0
472 const int result = qt_poll_msecs(&pfd, 1, timeout);-
473-
474 if (result == -1
result == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
475 d->errorOccurred(QLocalSocket::UnknownSocketError,
never executed: d->errorOccurred(QLocalSocket::UnknownSocketError, QLatin1String("QLocalSocket::waitForConnected"));
0
476 QLatin1String("QLocalSocket::waitForConnected"));
never executed: d->errorOccurred(QLocalSocket::UnknownSocketError, QLatin1String("QLocalSocket::waitForConnected"));
0
477 else if (result > 0
result > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
478 d->_q_connectToSocket();
never executed: d->_q_connectToSocket();
0
479 }
never executed: end of block
while (state() == ConnectingState
state() == ConnectingStateDescription
TRUEnever evaluated
FALSEnever evaluated
&& !timer.hasExpired(msec)
!timer.hasExpired(msec)Description
TRUEnever evaluated
FALSEnever evaluated
);
0
480-
481 return
never executed: return (state() == ConnectedState);
(state() == ConnectedState);
never executed: return (state() == ConnectedState);
0
482}-
483-
484bool QLocalSocket::waitForDisconnected(int msecs)-
485{-
486 QLocalSocketPrivate * const d = d_func();-
487 if (state() == UnconnectedState
state() == UnconnectedStateDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
) {
1-5
488 QMessageLogger(__FILE__, 543, __PRETTY_FUNCTION__).warning("QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState");-
489 return
executed 1 time by 1 test: return false;
Executed by:
  • tst_qlocalsocket - unknown status
false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_qlocalsocket - unknown status
1
490 }-
491 return
executed 5 times by 1 test: return (d->unixSocket.waitForDisconnected(msecs));
Executed by:
  • tst_qlocalsocket - unknown status
(d->unixSocket.waitForDisconnected(msecs));
executed 5 times by 1 test: return (d->unixSocket.waitForDisconnected(msecs));
Executed by:
  • tst_qlocalsocket - unknown status
5
492}-
493-
494bool QLocalSocket::waitForReadyRead(int msecs)-
495{-
496 QLocalSocketPrivate * const d = d_func();-
497 if (state() == QLocalSocket::UnconnectedState
state() == QLo...connectedStateDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
FALSEevaluated 2049 times by 2 tests
Evaluated by:
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
)
7-2049
498 return
executed 7 times by 1 test: return false;
Executed by:
  • tst_qlocalsocket - unknown status
false;
executed 7 times by 1 test: return false;
Executed by:
  • tst_qlocalsocket - unknown status
7
499 return
executed 2049 times by 2 tests: return (d->unixSocket.waitForReadyRead(msecs));
Executed by:
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
(d->unixSocket.waitForReadyRead(msecs));
executed 2049 times by 2 tests: return (d->unixSocket.waitForReadyRead(msecs));
Executed by:
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
2049
500}-
501-
502-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9