qnativesocketengine_unix.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/socket/qnativesocketengine_unix.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Copyright (C) 2016 Intel Corporation.-
5** Contact: https://www.qt.io/licensing/-
6**-
7** This file is part of the QtNetwork module of the Qt Toolkit.-
8**-
9** $QT_BEGIN_LICENSE:LGPL$-
10** Commercial License Usage-
11** Licensees holding valid commercial Qt licenses may use this file in-
12** accordance with the commercial license agreement provided with the-
13** Software or, alternatively, in accordance with the terms contained in-
14** a written agreement between you and The Qt Company. For licensing terms-
15** and conditions see https://www.qt.io/terms-conditions. For further-
16** information use the contact form at https://www.qt.io/contact-us.-
17**-
18** GNU Lesser General Public License Usage-
19** Alternatively, this file may be used under the terms of the GNU Lesser-
20** General Public License version 3 as published by the Free Software-
21** Foundation and appearing in the file LICENSE.LGPL3 included in the-
22** packaging of this file. Please review the following information to-
23** ensure the GNU Lesser General Public License version 3 requirements-
24** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
25**-
26** GNU General Public License Usage-
27** Alternatively, this file may be used under the terms of the GNU-
28** General Public License version 2.0 or (at your option) the GNU General-
29** Public license version 3 or any later version approved by the KDE Free-
30** Qt Foundation. The licenses are as published by the Free Software-
31** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
32** included in the packaging of this file. Please review the following-
33** information to ensure the GNU General Public License requirements will-
34** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
35** https://www.gnu.org/licenses/gpl-3.0.html.-
36**-
37** $QT_END_LICENSE$-
38**-
39****************************************************************************/-
40-
41//#define QNATIVESOCKETENGINE_DEBUG-
42#include "qnativesocketengine_p.h"-
43#include "private/qnet_unix_p.h"-
44#include "qiodevice.h"-
45#include "qhostaddress.h"-
46#include "qelapsedtimer.h"-
47#include "qvarlengtharray.h"-
48#include "qnetworkinterface.h"-
49#include <time.h>-
50#include <errno.h>-
51#include <fcntl.h>-
52#ifndef QT_NO_IPV6IFNAME-
53#include <net/if.h>-
54#endif-
55#ifdef QT_LINUXBASE-
56#include <arpa/inet.h>-
57#endif-
58#ifdef Q_OS_BSD4-
59#include <net/if_dl.h>-
60#endif-
61#ifdef Q_OS_INTEGRITY-
62#include <sys/uio.h>-
63#endif-
64-
65#if defined QNATIVESOCKETENGINE_DEBUG-
66#include <qstring.h>-
67#include <ctype.h>-
68#endif-
69-
70#include <netinet/tcp.h>-
71-
72QT_BEGIN_NAMESPACE-
73-
74#if defined QNATIVESOCKETENGINE_DEBUG-
75-
76/*-
77 Returns a human readable representation of the first \a len-
78 characters in \a data.-
79*/-
80static QByteArray qt_prettyDebug(const char *data, int len, int maxSize)-
81{-
82 if (!data) return "(null)";-
83 QByteArray out;-
84 for (int i = 0; i < len; ++i) {-
85 char c = data[i];-
86 if (isprint(c)) {-
87 out += c;-
88 } else switch (c) {-
89 case '\n': out += "\\n"; break;-
90 case '\r': out += "\\r"; break;-
91 case '\t': out += "\\t"; break;-
92 default:-
93 QString tmp;-
94 tmp.sprintf("\\%o", c);-
95 out += tmp.toLatin1();-
96 }-
97 }-
98-
99 if (len < maxSize)-
100 out += "...";-
101-
102 return out;-
103}-
104#endif-
105-
106/*-
107 Extracts the port and address from a sockaddr, and stores them in-
108 \a port and \a addr if they are non-null.-
109*/-
110static inline void qt_socket_getPortAndAddress(const qt_sockaddr *s, quint16 *port, QHostAddress *addr)-
111{-
112 if (s->a.sa_family == AF_INET6) {
s->a.sa_family == 10Description
TRUEevaluated 1789 times by 14 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHostInfo
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEevaluated 8249 times by 30 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • ...
1789-8249
113 Q_IPV6ADDR tmp;-
114 memcpy(&tmp, &s->a6.sin6_addr, sizeof(tmp));-
115 if (addr) {
addrDescription
TRUEevaluated 1789 times by 14 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHostInfo
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEnever evaluated
0-1789
116 QHostAddress tmpAddress;-
117 tmpAddress.setAddress(tmp);-
118 *addr = tmpAddress;-
119 if (s->a6.sin6_scope_id)
s->a6.sin6_scope_idDescription
TRUEevaluated 30 times by 2 tests
Evaluated by:
  • tst_QTcpServer
  • tst_QUdpSocket
FALSEevaluated 1759 times by 14 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHostInfo
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
30-1759
120 addr->setScopeId(QNetworkInterface::interfaceNameFromIndex(s->a6.sin6_scope_id));
executed 30 times by 2 tests: addr->setScopeId(QNetworkInterface::interfaceNameFromIndex(s->a6.sin6_scope_id));
Executed by:
  • tst_QTcpServer
  • tst_QUdpSocket
30
121 }
executed 1789 times by 14 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QHostInfo
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
1789
122 if (port)
portDescription
TRUEevaluated 1789 times by 14 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHostInfo
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEnever evaluated
0-1789
123 *port = ntohs(s->a6.sin6_port);
executed 1789 times by 14 tests: *port = ntohs(s->a6.sin6_port);
Executed by:
  • tst_NetworkSelfTest
  • tst_QHostInfo
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
1789
124 return;
executed 1789 times by 14 tests: return;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHostInfo
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
1789
125 }-
126-
127 if (port)
portDescription
TRUEevaluated 8249 times by 30 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • ...
FALSEnever evaluated
0-8249
128 *port = ntohs(s->a4.sin_port);
executed 8249 times by 30 tests: *port = ntohs(s->a4.sin_port);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • ...
8249
129 if (addr) {
addrDescription
TRUEevaluated 8249 times by 30 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • ...
FALSEnever evaluated
0-8249
130 QHostAddress tmpAddress;-
131 tmpAddress.setAddress(ntohl(s->a4.sin_addr.s_addr));-
132 *addr = tmpAddress;-
133 }
executed 8249 times by 30 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • ...
8249
134}
executed 8249 times by 30 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • ...
8249
135-
136static void convertToLevelAndOption(QNativeSocketEngine::SocketOption opt,-
137 QAbstractSocket::NetworkLayerProtocol socketProtocol, int &level, int &n)-
138{-
139 n = -1;-
140 level = SOL_SOCKET; // default-
141-
142 switch (opt) {-
143 case QNativeSocketEngine::NonBlockingSocketOption: // fcntl, not setsockopt
never executed: case QNativeSocketEngine::NonBlockingSocketOption:
0
144 case QNativeSocketEngine::BindExclusively: // not handled on Unix
never executed: case QNativeSocketEngine::BindExclusively:
0
145 Q_UNREACHABLE();-
146-
147 case QNativeSocketEngine::BroadcastSocketOption:
code before this statement never executed: case QNativeSocketEngine::BroadcastSocketOption:
executed 140 times by 4 tests: case QNativeSocketEngine::BroadcastSocketOption:
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
0-140
148 n = SO_BROADCAST;-
149 break;
executed 140 times by 4 tests: break;
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
140
150 case QNativeSocketEngine::ReceiveBufferSocketOption:
executed 3 times by 1 test: case QNativeSocketEngine::ReceiveBufferSocketOption:
Executed by:
  • tst_platformsocketengine - unknown status
3
151 n = SO_RCVBUF;-
152 break;
executed 3 times by 1 test: break;
Executed by:
  • tst_platformsocketengine - unknown status
3
153 case QNativeSocketEngine::SendBufferSocketOption:
executed 3 times by 1 test: case QNativeSocketEngine::SendBufferSocketOption:
Executed by:
  • tst_platformsocketengine - unknown status
3
154 n = SO_SNDBUF;-
155 break;
executed 3 times by 1 test: break;
Executed by:
  • tst_platformsocketengine - unknown status
3
156 case QNativeSocketEngine::AddressReusable:
executed 748 times by 19 tests: case QNativeSocketEngine::AddressReusable:
Executed by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
748
157 n = SO_REUSEADDR;-
158 break;
executed 748 times by 19 tests: break;
Executed by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
748
159 case QNativeSocketEngine::ReceiveOutOfBandData:
executed 70161 times by 29 tests: case QNativeSocketEngine::ReceiveOutOfBandData:
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
70161
160 n = SO_OOBINLINE;-
161 break;
executed 70161 times by 29 tests: break;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
70161
162 case QNativeSocketEngine::LowDelayOption:
executed 645 times by 3 tests: case QNativeSocketEngine::LowDelayOption:
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_qtcpsocket - unknown status
645
163 level = IPPROTO_TCP;-
164 n = TCP_NODELAY;-
165 break;
executed 645 times by 3 tests: break;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_qtcpsocket - unknown status
645
166 case QNativeSocketEngine::KeepAliveOption:
executed 789 times by 9 tests: case QNativeSocketEngine::KeepAliveOption:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qtcpsocket - unknown status
789
167 n = SO_KEEPALIVE;-
168 break;
executed 789 times by 9 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qtcpsocket - unknown status
789
169 case QNativeSocketEngine::MulticastTtlOption:
executed 24 times by 1 test: case QNativeSocketEngine::MulticastTtlOption:
Executed by:
  • tst_QUdpSocket
24
170 if (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) {
socketProtocol...::IPv6ProtocolDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUdpSocket
socketProtocol...:AnyIPProtocolDescription
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUdpSocket
0-12
171 level = IPPROTO_IPV6;-
172 n = IPV6_MULTICAST_HOPS;-
173 } else
executed 12 times by 1 test: end of block
Executed by:
  • tst_QUdpSocket
12
174 {-
175 level = IPPROTO_IP;-
176 n = IP_MULTICAST_TTL;-
177 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QUdpSocket
12
178 break;
executed 24 times by 1 test: break;
Executed by:
  • tst_QUdpSocket
24
179 case QNativeSocketEngine::MulticastLoopbackOption:
executed 28 times by 1 test: case QNativeSocketEngine::MulticastLoopbackOption:
Executed by:
  • tst_QUdpSocket
28
180 if (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) {
socketProtocol...::IPv6ProtocolDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QUdpSocket
socketProtocol...:AnyIPProtocolDescription
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QUdpSocket
0-14
181 level = IPPROTO_IPV6;-
182 n = IPV6_MULTICAST_LOOP;-
183 } else
executed 14 times by 1 test: end of block
Executed by:
  • tst_QUdpSocket
14
184 {-
185 level = IPPROTO_IP;-
186 n = IP_MULTICAST_LOOP;-
187 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_QUdpSocket
14
188 break;
executed 28 times by 1 test: break;
Executed by:
  • tst_QUdpSocket
28
189 case QNativeSocketEngine::TypeOfServiceOption:
executed 4 times by 1 test: case QNativeSocketEngine::TypeOfServiceOption:
Executed by:
  • tst_qtcpsocket - unknown status
4
190 if (socketProtocol == QAbstractSocket::IPv4Protocol) {
socketProtocol...::IPv4ProtocolDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-4
191 level = IPPROTO_IP;-
192 n = IP_TOS;-
193 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qtcpsocket - unknown status
4
194 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qtcpsocket - unknown status
4
195 case QNativeSocketEngine::ReceivePacketInformation:
executed 140 times by 4 tests: case QNativeSocketEngine::ReceivePacketInformation:
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
140
196 if (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) {
socketProtocol...::IPv6ProtocolDescription
TRUEevaluated 42 times by 2 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
FALSEevaluated 98 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
socketProtocol...:AnyIPProtocolDescription
TRUEevaluated 54 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 44 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
42-98
197 level = IPPROTO_IPV6;-
198 n = IPV6_RECVPKTINFO;-
199 } else if (socketProtocol == QAbstractSocket::IPv4Protocol) {
executed 96 times by 4 tests: end of block
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
socketProtocol...::IPv4ProtocolDescription
TRUEevaluated 44 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-96
200 level = IPPROTO_IP;-
201#ifdef IP_PKTINFO-
202 n = IP_PKTINFO;-
203#elif defined(IP_RECVDSTADDR)-
204 // variant found in QNX and FreeBSD; it will get us only the-
205 // destination address, not the interface; we need IP_RECVIF for that.-
206 n = IP_RECVDSTADDR;-
207#endif-
208 }
executed 44 times by 4 tests: end of block
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
44
209 break;
executed 140 times by 4 tests: break;
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
140
210 case QNativeSocketEngine::ReceiveHopLimit:
executed 140 times by 4 tests: case QNativeSocketEngine::ReceiveHopLimit:
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
140
211 if (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) {
socketProtocol...::IPv6ProtocolDescription
TRUEevaluated 42 times by 2 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
FALSEevaluated 98 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
socketProtocol...:AnyIPProtocolDescription
TRUEevaluated 54 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 44 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
42-98
212 level = IPPROTO_IPV6;-
213 n = IPV6_RECVHOPLIMIT;-
214 } else if (socketProtocol == QAbstractSocket::IPv4Protocol) {
executed 96 times by 4 tests: end of block
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
socketProtocol...::IPv4ProtocolDescription
TRUEevaluated 44 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-96
215#ifdef IP_RECVTTL // IP_RECVTTL is a non-standard extension supported on some OS-
216 level = IPPROTO_IP;-
217 n = IP_RECVTTL;-
218#endif-
219 }
executed 44 times by 4 tests: end of block
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
44
220 break;
executed 140 times by 4 tests: break;
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
140
221 }-
222}
executed 72825 times by 29 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
72825
223-
224/*! \internal-
225-
226 Creates and returns a new socket descriptor of type \a socketType-
227 and \a socketProtocol. Returns -1 on failure.-
228*/-
229bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType socketType,-
230 QAbstractSocket::NetworkLayerProtocol &socketProtocol)-
231{-
232 int protocol = (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) ? AF_INET6 : AF_INET;
socketProtocol...::IPv6ProtocolDescription
TRUEevaluated 526 times by 9 tests
Evaluated by:
  • tst_QHostInfo
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qobject - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 69776 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • ...
socketProtocol...:AnyIPProtocolDescription
TRUEevaluated 581 times by 13 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEevaluated 69195 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • ...
526-69776
233 int type = (socketType == QAbstractSocket::UdpSocket) ? SOCK_DGRAM : SOCK_STREAM;
(socketType ==...et::UdpSocket)Description
TRUEevaluated 140 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 70162 times by 29 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
140-70162
234-
235 int socket = qt_safe_socket(protocol, type, 0, O_NONBLOCK);-
236 if (socket < 0 && socketProtocol == QAbstractSocket::AnyIPProtocol && errno == EAFNOSUPPORT) {
socket < 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_platformsocketengine - unknown status
FALSEevaluated 70301 times by 29 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
socketProtocol...:AnyIPProtocolDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_platformsocketengine - unknown status
(*__errno_location ()) == 97Description
TRUEnever evaluated
FALSEnever evaluated
0-70301
237 protocol = AF_INET;-
238 socket = qt_safe_socket(protocol, type, 0, O_NONBLOCK);-
239 socketProtocol = QAbstractSocket::IPv4Protocol;-
240 }
never executed: end of block
0
241-
242 if (socket < 0) {
socket < 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_platformsocketengine - unknown status
FALSEevaluated 70301 times by 29 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
1-70301
243 int ecopy = errno;-
244 switch (ecopy) {-
245 case EPROTONOSUPPORT:
never executed: case 93:
0
246 case EAFNOSUPPORT:
never executed: case 97:
0
247 case EINVAL:
never executed: case 22:
0
248 setError(QAbstractSocket::UnsupportedSocketOperationError, ProtocolUnsupportedErrorString);-
249 break;
never executed: break;
0
250 case ENFILE:
never executed: case 23:
0
251 case EMFILE:
executed 1 time by 1 test: case 24:
Executed by:
  • tst_platformsocketengine - unknown status
1
252 case ENOBUFS:
never executed: case 105:
0
253 case ENOMEM:
never executed: case 12:
0
254 setError(QAbstractSocket::SocketResourceError, ResourceErrorString);-
255 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_platformsocketengine - unknown status
1
256 case EACCES:
never executed: case 13:
0
257 setError(QAbstractSocket::SocketAccessError, AccessErrorString);-
258 break;
never executed: break;
0
259 default:
never executed: default:
0
260 break;
never executed: break;
0
261 }-
262-
263#if defined (QNATIVESOCKETENGINE_DEBUG)-
264 qDebug("QNativeSocketEnginePrivate::createNewSocket(%d, %d) == false (%s)",-
265 socketType, socketProtocol,-
266 strerror(ecopy));-
267#endif-
268-
269 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_platformsocketengine - unknown status
1
270 }-
271-
272#if defined (QNATIVESOCKETENGINE_DEBUG)-
273 qDebug("QNativeSocketEnginePrivate::createNewSocket(%d, %d) == true",-
274 socketType, socketProtocol);-
275#endif-
276-
277 socketDescriptor = socket;-
278 if (socket != -1) {
socket != -1Description
TRUEevaluated 70301 times by 29 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
FALSEnever evaluated
0-70301
279 this->socketProtocol = socketProtocol;-
280 this->socketType = socketType;-
281 }
executed 70301 times by 29 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
70301
282 return true;
executed 70301 times by 29 tests: return true;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
70301
283}-
284-
285/*-
286 Returns the value of the socket option \a opt.-
287*/-
288int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) const-
289{-
290 Q_Q(const QNativeSocketEngine);-
291 if (!q->isValid())
!q->isValid()Description
TRUEnever evaluated
FALSEevaluated 41 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
0-41
292 return -1;
never executed: return -1;
0
293-
294 // handle non-getsockopt cases first-
295 if (opt == QNativeSocketEngine::BindExclusively || opt == QNativeSocketEngine::NonBlockingSocketOption
opt == QNative...indExclusivelyDescription
TRUEnever evaluated
FALSEevaluated 41 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
opt == QNative...ngSocketOptionDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_platformsocketengine - unknown status
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
0-41
296 || opt == QNativeSocketEngine::BroadcastSocketOption)
opt == QNative...stSocketOptionDescription
TRUEnever evaluated
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
0-40
297 return -1;
executed 1 time by 1 test: return -1;
Executed by:
  • tst_platformsocketengine - unknown status
1
298-
299 int n, level;-
300 int v = -1;-
301 QT_SOCKOPTLEN_T len = sizeof(v);-
302-
303 convertToLevelAndOption(opt, socketProtocol, level, n);-
304 if (n != -1 && ::getsockopt(socketDescriptor, level, n, (char *) &v, &len) != -1)
n != -1Description
TRUEevaluated 40 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
::getsockopt(s...v, &len) != -1Description
TRUEevaluated 40 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-40
305 return v;
executed 40 times by 3 tests: return v;
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
40
306-
307 return -1;
never executed: return -1;
0
308}-
309-
310-
311/*-
312 Sets the socket option \a opt to \a v.-
313*/-
314bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt, int v)-
315{-
316 Q_Q(QNativeSocketEngine);-
317 if (!q->isValid())
!q->isValid()Description
TRUEnever evaluated
FALSEevaluated 73774 times by 31 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • ...
0-73774
318 return false;
never executed: return false;
0
319-
320 // handle non-setsockopt cases first-
321 switch (opt) {-
322 case QNativeSocketEngine::NonBlockingSocketOption: {
executed 989 times by 19 tests: case QNativeSocketEngine::NonBlockingSocketOption:
Executed by:
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
989
323 // Make the socket nonblocking.-
324#if !defined(Q_OS_VXWORKS)-
325 int flags = ::fcntl(socketDescriptor, F_GETFL, 0);-
326 if (flags == -1) {
flags == -1Description
TRUEnever evaluated
FALSEevaluated 989 times by 19 tests
Evaluated by:
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
0-989
327#ifdef QNATIVESOCKETENGINE_DEBUG-
328 perror("QNativeSocketEnginePrivate::setOption(): fcntl(F_GETFL) failed");-
329#endif-
330 return false;
never executed: return false;
0
331 }-
332 if (::fcntl(socketDescriptor, F_SETFL, flags | O_NONBLOCK) == -1) {
::fcntl(socket...| 04000) == -1Description
TRUEnever evaluated
FALSEevaluated 989 times by 19 tests
Evaluated by:
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
0-989
333#ifdef QNATIVESOCKETENGINE_DEBUG-
334 perror("QNativeSocketEnginePrivate::setOption(): fcntl(F_SETFL) failed");-
335#endif-
336 return false;
never executed: return false;
0
337 }-
338#else // Q_OS_VXWORKS-
339 int onoff = 1;-
340-
341 if (qt_safe_ioctl(socketDescriptor, FIONBIO, &onoff) < 0) {-
342-
343#ifdef QNATIVESOCKETENGINE_DEBUG-
344 perror("QNativeSocketEnginePrivate::setOption(): ioctl(FIONBIO, 1) failed");-
345#endif-
346 return false;-
347 }-
348#endif // Q_OS_VXWORKS-
349 return true;
executed 989 times by 19 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
989
350 }-
351 case QNativeSocketEngine::BindExclusively:
never executed: case QNativeSocketEngine::BindExclusively:
0
352 return true;
never executed: return true;
0
353-
354 default:
executed 72785 times by 29 tests: default:
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
72785
355 break;
executed 72785 times by 29 tests: break;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
72785
356 }-
357-
358 int n, level;-
359 convertToLevelAndOption(opt, socketProtocol, level, n);-
360#if defined(SO_REUSEPORT) && !defined(Q_OS_LINUX)-
361 if (opt == QNativeSocketEngine::AddressReusable) {-
362 // on OS X, SO_REUSEADDR isn't sufficient to allow multiple binds to the-
363 // same port (which is useful for multicast UDP). SO_REUSEPORT is, but-
364 // we most definitely do not want to use this for TCP. See QTBUG-6305.-
365 if (socketType == QAbstractSocket::UdpSocket)-
366 n = SO_REUSEPORT;-
367 }-
368#endif-
369-
370 return ::setsockopt(socketDescriptor, level, n, (char *) &v, sizeof(v)) == 0;
executed 72785 times by 29 tests: return ::setsockopt(socketDescriptor, level, n, (char *) &v, sizeof(v)) == 0;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
72785
371}-
372-
373bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16 port)-
374{-
375#ifdef QNATIVESOCKETENGINE_DEBUG-
376 qDebug() << "QNativeSocketEnginePrivate::nativeConnect() " << socketDescriptor;-
377#endif-
378-
379 qt_sockaddr aa;-
380 QT_SOCKLEN_T sockAddrSize;-
381 setPortAndAddress(port, addr, &aa, &sockAddrSize);-
382-
383 int connectResult = qt_safe_connect(socketDescriptor, &aa.a, sockAddrSize);-
384#if defined (QNATIVESOCKETENGINE_DEBUG)-
385 int ecopy = errno;-
386#endif-
387 if (connectResult == -1) {
connectResult == -1Description
TRUEevaluated 4162 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • ...
FALSEevaluated 3313 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • ...
3313-4162
388 switch (errno) {-
389 case EISCONN:
never executed: case 106:
0
390 socketState = QAbstractSocket::ConnectedState;-
391 break;
never executed: break;
0
392 case ECONNREFUSED:
executed 322 times by 9 tests: case 111:
Executed by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qtcpsocket - unknown status
322
393 case EINVAL:
never executed: case 22:
0
394 setError(QAbstractSocket::ConnectionRefusedError, ConnectionRefusedErrorString);-
395 socketState = QAbstractSocket::UnconnectedState;-
396 break;
executed 322 times by 9 tests: break;
Executed by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_Spdy
  • tst_qhttpsocketengine - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qtcpsocket - unknown status
322
397 case ETIMEDOUT:
never executed: case 110:
0
398 setError(QAbstractSocket::NetworkError, ConnectionTimeOutErrorString);-
399 break;
never executed: break;
0
400 case EHOSTUNREACH:
never executed: case 113:
0
401 setError(QAbstractSocket::NetworkError, HostUnreachableErrorString);-
402 socketState = QAbstractSocket::UnconnectedState;-
403 break;
never executed: break;
0
404 case ENETUNREACH:
executed 4 times by 2 tests: case 101:
Executed by:
  • tst_QNetworkReply
  • tst_qtcpsocket - unknown status
4
405 setError(QAbstractSocket::NetworkError, NetworkUnreachableErrorString);-
406 socketState = QAbstractSocket::UnconnectedState;-
407 break;
executed 4 times by 2 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_qtcpsocket - unknown status
4
408 case EADDRINUSE:
never executed: case 98:
0
409 setError(QAbstractSocket::NetworkError, AddressInuseErrorString);-
410 break;
never executed: break;
0
411 case EINPROGRESS:
executed 3836 times by 28 tests: case 115:
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • ...
3836
412 case EALREADY:
never executed: case 114:
0
413 setError(QAbstractSocket::UnfinishedSocketOperationError, InvalidSocketErrorString);-
414 socketState = QAbstractSocket::ConnectingState;-
415 break;
executed 3836 times by 28 tests: break;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • ...
3836
416 case EAGAIN:
never executed: case 11:
0
417 setError(QAbstractSocket::UnfinishedSocketOperationError, InvalidSocketErrorString);-
418 break;
never executed: break;
0
419 case EACCES:
never executed: case 13:
0
420 case EPERM:
never executed: case 1:
0
421 setError(QAbstractSocket::SocketAccessError, AccessErrorString);-
422 socketState = QAbstractSocket::UnconnectedState;-
423 break;
never executed: break;
0
424 case EAFNOSUPPORT:
never executed: case 97:
0
425 case EBADF:
never executed: case 9:
0
426 case EFAULT:
never executed: case 14:
0
427 case ENOTSOCK:
never executed: case 88:
0
428 socketState = QAbstractSocket::UnconnectedState;-
429 default:
code before this statement never executed: default:
never executed: default:
0
430 break;
never executed: break;
0
431 }-
432-
433 if (socketState != QAbstractSocket::ConnectedState) {
socketState !=...ConnectedStateDescription
TRUEevaluated 4162 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • ...
FALSEnever evaluated
0-4162
434#if defined (QNATIVESOCKETENGINE_DEBUG)-
435 qDebug("QNativeSocketEnginePrivate::nativeConnect(%s, %i) == false (%s)",-
436 addr.toString().toLatin1().constData(), port,-
437 socketState == QAbstractSocket::ConnectingState-
438 ? "Connection in progress" : strerror(ecopy));-
439#endif-
440 return false;
executed 4162 times by 28 tests: return false;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • ...
4162
441 }-
442 }
never executed: end of block
0
443-
444#if defined (QNATIVESOCKETENGINE_DEBUG)-
445 qDebug("QNativeSocketEnginePrivate::nativeConnect(%s, %i) == true",-
446 addr.toString().toLatin1().constData(), port);-
447#endif-
448-
449 socketState = QAbstractSocket::ConnectedState;-
450 return true;
executed 3313 times by 28 tests: return true;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • ...
3313
451}-
452-
453bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &address, quint16 port)-
454{-
455 qt_sockaddr aa;-
456 QT_SOCKLEN_T sockAddrSize;-
457 setPortAndAddress(port, address, &aa, &sockAddrSize);-
458-
459#ifdef IPV6_V6ONLY-
460 if (aa.a.sa_family == AF_INET6) {
aa.a.sa_family == 10Description
TRUEevaluated 663 times by 14 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHostInfo
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEevaluated 291 times by 14 tests
Evaluated by:
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
291-663
461 int ipv6only = 0;-
462 if (address.protocol() == QAbstractSocket::IPv6Protocol)
address.protoc...::IPv6ProtocolDescription
TRUEevaluated 80 times by 6 tests
Evaluated by:
  • tst_QHostInfo
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 583 times by 13 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
80-583
463 ipv6only = 1;
executed 80 times by 6 tests: ipv6only = 1;
Executed by:
  • tst_QHostInfo
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
80
464 //default value of this socket option varies depending on unix variant (or system configuration on BSD), so always set it explicitly-
465 ::setsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&ipv6only, sizeof(ipv6only) );-
466 }
executed 663 times by 14 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QHostInfo
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
663
467#endif-
468-
469 int bindResult = QT_SOCKET_BIND(socketDescriptor, &aa.a, sockAddrSize);-
470 if (bindResult < 0 && errno == EAFNOSUPPORT && address.protocol() == QAbstractSocket::AnyIPProtocol) {
bindResult < 0Description
TRUEevaluated 24 times by 4 tests
Evaluated by:
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 930 times by 20 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
(*__errno_location ()) == 97Description
TRUEnever evaluated
FALSEevaluated 24 times by 4 tests
Evaluated by:
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
address.protoc...:AnyIPProtocolDescription
TRUEnever evaluated
FALSEnever evaluated
0-930
471 // retry with v4-
472 aa.a4.sin_family = AF_INET;-
473 aa.a4.sin_port = htons(port);-
474 aa.a4.sin_addr.s_addr = htonl(address.toIPv4Address());-
475 sockAddrSize = sizeof(aa.a4);-
476 bindResult = QT_SOCKET_BIND(socketDescriptor, &aa.a, sockAddrSize);-
477 }
never executed: end of block
0
478-
479 if (bindResult < 0) {
bindResult < 0Description
TRUEevaluated 24 times by 4 tests
Evaluated by:
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 930 times by 20 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
24-930
480#if defined (QNATIVESOCKETENGINE_DEBUG)-
481 int ecopy = errno;-
482#endif-
483 switch(errno) {-
484 case EADDRINUSE:
executed 13 times by 3 tests: case 98:
Executed by:
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
13
485 setError(QAbstractSocket::AddressInUseError, AddressInuseErrorString);-
486 break;
executed 13 times by 3 tests: break;
Executed by:
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
13
487 case EACCES:
executed 5 times by 2 tests: case 13:
Executed by:
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
5
488 setError(QAbstractSocket::SocketAccessError, AddressProtectedErrorString);-
489 break;
executed 5 times by 2 tests: break;
Executed by:
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
5
490 case EINVAL:
executed 1 time by 1 test: case 22:
Executed by:
  • tst_QUdpSocket
1
491 setError(QAbstractSocket::UnsupportedSocketOperationError, OperationUnsupportedErrorString);-
492 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QUdpSocket
1
493 case EADDRNOTAVAIL:
executed 5 times by 2 tests: case 99:
Executed by:
  • tst_QTcpServer
  • tst_qtcpsocket - unknown status
5
494 setError(QAbstractSocket::SocketAddressNotAvailableError, AddressNotAvailableErrorString);-
495 break;
executed 5 times by 2 tests: break;
Executed by:
  • tst_QTcpServer
  • tst_qtcpsocket - unknown status
5
496 default:
never executed: default:
0
497 break;
never executed: break;
0
498 }-
499-
500#if defined (QNATIVESOCKETENGINE_DEBUG)-
501 qDebug("QNativeSocketEnginePrivate::nativeBind(%s, %i) == false (%s)",-
502 address.toString().toLatin1().constData(), port, strerror(ecopy));-
503#endif-
504-
505 return false;
executed 24 times by 4 tests: return false;
Executed by:
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
24
506 }-
507-
508#if defined (QNATIVESOCKETENGINE_DEBUG)-
509 qDebug("QNativeSocketEnginePrivate::nativeBind(%s, %i) == true",-
510 address.toString().toLatin1().constData(), port);-
511#endif-
512 socketState = QAbstractSocket::BoundState;-
513 return true;
executed 930 times by 20 tests: return true;
Executed by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
930
514}-
515-
516bool QNativeSocketEnginePrivate::nativeListen(int backlog)-
517{-
518 if (qt_safe_listen(socketDescriptor, backlog) < 0) {
qt_safe_listen..., backlog) < 0Description
TRUEnever evaluated
FALSEevaluated 738 times by 19 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
0-738
519#if defined (QNATIVESOCKETENGINE_DEBUG)-
520 int ecopy = errno;-
521#endif-
522 switch (errno) {-
523 case EADDRINUSE:
never executed: case 98:
0
524 setError(QAbstractSocket::AddressInUseError,-
525 PortInuseErrorString);-
526 break;
never executed: break;
0
527 default:
never executed: default:
0
528 break;
never executed: break;
0
529 }-
530-
531#if defined (QNATIVESOCKETENGINE_DEBUG)-
532 qDebug("QNativeSocketEnginePrivate::nativeListen(%i) == false (%s)",-
533 backlog, strerror(ecopy));-
534#endif-
535 return false;
never executed: return false;
0
536 }-
537-
538#if defined (QNATIVESOCKETENGINE_DEBUG)-
539 qDebug("QNativeSocketEnginePrivate::nativeListen(%i) == true", backlog);-
540#endif-
541-
542 socketState = QAbstractSocket::ListeningState;-
543 return true;
executed 738 times by 19 tests: return true;
Executed by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
738
544}-
545-
546int QNativeSocketEnginePrivate::nativeAccept()-
547{-
548 int acceptedDescriptor = qt_safe_accept(socketDescriptor, 0, 0);-
549 if (acceptedDescriptor == -1) {
acceptedDescriptor == -1Description
TRUEevaluated 796 times by 15 tests
Evaluated by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEevaluated 827 times by 17 tests
Evaluated by:
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
796-827
550 switch (errno) {-
551 case EBADF:
never executed: case 9:
0
552 case EOPNOTSUPP:
never executed: case 95:
0
553 setError(QAbstractSocket::UnsupportedSocketOperationError, InvalidSocketErrorString);-
554 break;
never executed: break;
0
555 case ECONNABORTED:
never executed: case 103:
0
556 setError(QAbstractSocket::NetworkError, RemoteHostClosedErrorString);-
557 break;
never executed: break;
0
558 case EFAULT:
never executed: case 14:
0
559 case ENOTSOCK:
never executed: case 88:
0
560 setError(QAbstractSocket::SocketResourceError, NotSocketErrorString);-
561 break;
never executed: break;
0
562 case EPROTONOSUPPORT:
never executed: case 93:
0
563#if !defined(Q_OS_OPENBSD)-
564 case EPROTO:
never executed: case 71:
0
565#endif-
566 case EAFNOSUPPORT:
never executed: case 97:
0
567 case EINVAL:
never executed: case 22:
0
568 setError(QAbstractSocket::UnsupportedSocketOperationError, ProtocolUnsupportedErrorString);-
569 break;
never executed: break;
0
570 case ENFILE:
never executed: case 23:
0
571 case EMFILE:
never executed: case 24:
0
572 case ENOBUFS:
never executed: case 105:
0
573 case ENOMEM:
never executed: case 12:
0
574 setError(QAbstractSocket::SocketResourceError, ResourceErrorString);-
575 break;
never executed: break;
0
576 case EACCES:
never executed: case 13:
0
577 case EPERM:
never executed: case 1:
0
578 setError(QAbstractSocket::SocketAccessError, AccessErrorString);-
579 break;
never executed: break;
0
580#if EAGAIN != EWOULDBLOCK-
581 case EWOULDBLOCK:-
582#endif-
583 case EAGAIN:
executed 796 times by 15 tests: case 11:
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
796
584 setError(QAbstractSocket::TemporaryError, TemporaryErrorString);-
585 break;
executed 796 times by 15 tests: break;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
796
586 default:
never executed: default:
0
587 setError(QAbstractSocket::UnknownSocketError, UnknownSocketErrorString);-
588 break;
never executed: break;
0
589 }-
590 }-
591-
592 return acceptedDescriptor;
executed 1623 times by 17 tests: return acceptedDescriptor;
Executed by:
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QXmlInputSource
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
1623
593}-
594-
595#ifndef QT_NO_NETWORKINTERFACE-
596-
597static bool multicastMembershipHelper(QNativeSocketEnginePrivate *d,-
598 int how6,-
599 int how4,-
600 const QHostAddress &groupAddress,-
601 const QNetworkInterface &interface)-
602{-
603 int level = 0;-
604 int sockOpt = 0;-
605 void *sockArg;-
606 int sockArgSize;-
607-
608 ip_mreq mreq4;-
609 ipv6_mreq mreq6;-
610-
611 if (groupAddress.protocol() == QAbstractSocket::IPv6Protocol) {
groupAddress.p...::IPv6ProtocolDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUdpSocket
6
612 level = IPPROTO_IPV6;-
613 sockOpt = how6;-
614 sockArg = &mreq6;-
615 sockArgSize = sizeof(mreq6);-
616 memset(&mreq6, 0, sizeof(mreq6));-
617 Q_IPV6ADDR ip6 = groupAddress.toIPv6Address();-
618 memcpy(&mreq6.ipv6mr_multiaddr, &ip6, sizeof(ip6));-
619 mreq6.ipv6mr_interface = interface.index();-
620 } else
executed 6 times by 1 test: end of block
Executed by:
  • tst_QUdpSocket
6
621 if (groupAddress.protocol() == QAbstractSocket::IPv4Protocol) {
groupAddress.p...::IPv4ProtocolDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEnever evaluated
0-6
622 level = IPPROTO_IP;-
623 sockOpt = how4;-
624 sockArg = &mreq4;-
625 sockArgSize = sizeof(mreq4);-
626 memset(&mreq4, 0, sizeof(mreq4));-
627 mreq4.imr_multiaddr.s_addr = htonl(groupAddress.toIPv4Address());-
628-
629 if (interface.isValid()) {
interface.isValid()Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUdpSocket
0-6
630 const QList<QNetworkAddressEntry> addressEntries = interface.addressEntries();-
631 if (!addressEntries.isEmpty()) {
!addressEntries.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
632 QHostAddress firstIP = addressEntries.first().ip();-
633 mreq4.imr_interface.s_addr = htonl(firstIP.toIPv4Address());-
634 } else {
never executed: end of block
0
635 d->setError(QAbstractSocket::NetworkError,-
636 QNativeSocketEnginePrivate::NetworkUnreachableErrorString);-
637 return false;
never executed: return false;
0
638 }-
639 } else {-
640 mreq4.imr_interface.s_addr = INADDR_ANY;-
641 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QUdpSocket
6
642 } else {-
643 // unreachable-
644 d->setError(QAbstractSocket::UnsupportedSocketOperationError,-
645 QNativeSocketEnginePrivate::ProtocolUnsupportedErrorString);-
646 return false;
never executed: return false;
0
647 }-
648-
649 int res = setsockopt(d->socketDescriptor, level, sockOpt, sockArg, sockArgSize);-
650 if (res == -1) {
res == -1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QUdpSocket
2-10
651 switch (errno) {-
652 case ENOPROTOOPT:
never executed: case 92:
0
653 d->setError(QAbstractSocket::UnsupportedSocketOperationError,-
654 QNativeSocketEnginePrivate::OperationUnsupportedErrorString);-
655 break;
never executed: break;
0
656 case EADDRNOTAVAIL:
never executed: case 99:
0
657 d->setError(QAbstractSocket::SocketAddressNotAvailableError,-
658 QNativeSocketEnginePrivate::AddressNotAvailableErrorString);-
659 break;
never executed: break;
0
660 default:
executed 2 times by 1 test: default:
Executed by:
  • tst_QUdpSocket
2
661 d->setError(QAbstractSocket::UnknownSocketError,-
662 QNativeSocketEnginePrivate::UnknownSocketErrorString);-
663 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QUdpSocket
2
664 }-
665 return false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_QUdpSocket
2
666 }-
667 return true;
executed 10 times by 1 test: return true;
Executed by:
  • tst_QUdpSocket
10
668}-
669-
670bool QNativeSocketEnginePrivate::nativeJoinMulticastGroup(const QHostAddress &groupAddress,-
671 const QNetworkInterface &interface)-
672{-
673 return multicastMembershipHelper(this,
executed 8 times by 1 test: return multicastMembershipHelper(this, 20, 35, groupAddress, interface);
Executed by:
  • tst_QUdpSocket
8
674 IPV6_JOIN_GROUP,
executed 8 times by 1 test: return multicastMembershipHelper(this, 20, 35, groupAddress, interface);
Executed by:
  • tst_QUdpSocket
8
675 IP_ADD_MEMBERSHIP,
executed 8 times by 1 test: return multicastMembershipHelper(this, 20, 35, groupAddress, interface);
Executed by:
  • tst_QUdpSocket
8
676 groupAddress,
executed 8 times by 1 test: return multicastMembershipHelper(this, 20, 35, groupAddress, interface);
Executed by:
  • tst_QUdpSocket
8
677 interface);
executed 8 times by 1 test: return multicastMembershipHelper(this, 20, 35, groupAddress, interface);
Executed by:
  • tst_QUdpSocket
8
678}-
679-
680bool QNativeSocketEnginePrivate::nativeLeaveMulticastGroup(const QHostAddress &groupAddress,-
681 const QNetworkInterface &interface)-
682{-
683 return multicastMembershipHelper(this,
executed 4 times by 1 test: return multicastMembershipHelper(this, 21, 36, groupAddress, interface);
Executed by:
  • tst_QUdpSocket
4
684 IPV6_LEAVE_GROUP,
executed 4 times by 1 test: return multicastMembershipHelper(this, 21, 36, groupAddress, interface);
Executed by:
  • tst_QUdpSocket
4
685 IP_DROP_MEMBERSHIP,
executed 4 times by 1 test: return multicastMembershipHelper(this, 21, 36, groupAddress, interface);
Executed by:
  • tst_QUdpSocket
4
686 groupAddress,
executed 4 times by 1 test: return multicastMembershipHelper(this, 21, 36, groupAddress, interface);
Executed by:
  • tst_QUdpSocket
4
687 interface);
executed 4 times by 1 test: return multicastMembershipHelper(this, 21, 36, groupAddress, interface);
Executed by:
  • tst_QUdpSocket
4
688}-
689-
690QNetworkInterface QNativeSocketEnginePrivate::nativeMulticastInterface() const-
691{-
692 if (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) {
socketProtocol...::IPv6ProtocolDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
socketProtocol...:AnyIPProtocolDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
0-3
693 uint v;-
694 QT_SOCKOPTLEN_T sizeofv = sizeof(v);-
695 if (::getsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_MULTICAST_IF, &v, &sizeofv) == -1)
::getsockopt(s...sizeofv) == -1Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
0-3
696 return QNetworkInterface();
never executed: return QNetworkInterface();
0
697 return QNetworkInterface::interfaceFromIndex(v);
executed 3 times by 1 test: return QNetworkInterface::interfaceFromIndex(v);
Executed by:
  • tst_QUdpSocket
3
698 }-
699-
700 struct in_addr v = { 0 };-
701 QT_SOCKOPTLEN_T sizeofv = sizeof(v);-
702 if (::getsockopt(socketDescriptor, IPPROTO_IP, IP_MULTICAST_IF, &v, &sizeofv) == -1)
::getsockopt(s...sizeofv) == -1Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
0-3
703 return QNetworkInterface();
never executed: return QNetworkInterface();
0
704 if (v.s_addr != 0 && sizeofv >= QT_SOCKOPTLEN_T(sizeof(v))) {
v.s_addr != 0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEnever evaluated
sizeofv >= soc...n_t(sizeof(v))Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEnever evaluated
0-3
705 QHostAddress ipv4(ntohl(v.s_addr));-
706 QList<QNetworkInterface> ifaces = QNetworkInterface::allInterfaces();-
707 for (int i = 0; i < ifaces.count(); ++i) {
i < ifaces.count()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEnever evaluated
0-6
708 const QNetworkInterface &iface = ifaces.at(i);-
709 QList<QNetworkAddressEntry> entries = iface.addressEntries();-
710 for (int j = 0; j < entries.count(); ++j) {
j < entries.count()Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
3-9
711 const QNetworkAddressEntry &entry = entries.at(j);-
712 if (entry.ip() == ipv4)
entry.ip() == ipv4Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUdpSocket
3-6
713 return iface;
executed 3 times by 1 test: return iface;
Executed by:
  • tst_QUdpSocket
3
714 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QUdpSocket
6
715 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QUdpSocket
3
716 }
never executed: end of block
0
717 return QNetworkInterface();
never executed: return QNetworkInterface();
0
718}-
719-
720bool QNativeSocketEnginePrivate::nativeSetMulticastInterface(const QNetworkInterface &iface)-
721{-
722 if (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) {
socketProtocol...::IPv6ProtocolDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
socketProtocol...:AnyIPProtocolDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
0-3
723 uint v = iface.index();-
724 return (::setsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_MULTICAST_IF, &v, sizeof(v)) != -1);
executed 3 times by 1 test: return (::setsockopt(socketDescriptor, IPPROTO_IPV6, 17, &v, sizeof(v)) != -1);
Executed by:
  • tst_QUdpSocket
3
725 }-
726-
727 struct in_addr v;-
728 if (iface.isValid()) {
iface.isValid()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEnever evaluated
0-3
729 QList<QNetworkAddressEntry> entries = iface.addressEntries();-
730 for (int i = 0; i < entries.count(); ++i) {
i < entries.count()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEnever evaluated
0-3
731 const QNetworkAddressEntry &entry = entries.at(i);-
732 const QHostAddress &ip = entry.ip();-
733 if (ip.protocol() == QAbstractSocket::IPv4Protocol) {
ip.protocol() ...::IPv4ProtocolDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEnever evaluated
0-3
734 v.s_addr = htonl(ip.toIPv4Address());-
735 int r = ::setsockopt(socketDescriptor, IPPROTO_IP, IP_MULTICAST_IF, &v, sizeof(v));-
736 if (r != -1)
r != -1Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEnever evaluated
0-3
737 return true;
executed 3 times by 1 test: return true;
Executed by:
  • tst_QUdpSocket
3
738 }
never executed: end of block
0
739 }
never executed: end of block
0
740 return false;
never executed: return false;
0
741 }-
742-
743 v.s_addr = INADDR_ANY;-
744 return (::setsockopt(socketDescriptor, IPPROTO_IP, IP_MULTICAST_IF, &v, sizeof(v)) != -1);
never executed: return (::setsockopt(socketDescriptor, IPPROTO_IP, 32, &v, sizeof(v)) != -1);
0
745}-
746-
747#endif // QT_NO_NETWORKINTERFACE-
748-
749qint64 QNativeSocketEnginePrivate::nativeBytesAvailable() const-
750{-
751 int nbytes = 0;-
752 // gives shorter than true amounts on Unix domain sockets.-
753 qint64 available = -1;-
754-
755#if defined (SO_NREAD)-
756 if (socketType == QAbstractSocket::UdpSocket) {-
757 socklen_t sz = sizeof nbytes;-
758 if (!::getsockopt(socketDescriptor, SOL_SOCKET, SO_NREAD, &nbytes, &sz))-
759 available = nbytes;-
760 }-
761#endif-
762-
763 if (available == -1 && qt_safe_ioctl(socketDescriptor, FIONREAD, (char *) &nbytes) >= 0)
available == -1Description
TRUEevaluated 74694 times by 29 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
FALSEnever evaluated
qt_safe_ioctl(... &nbytes) >= 0Description
TRUEevaluated 74694 times by 29 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
FALSEnever evaluated
0-74694
764 available = nbytes;
executed 74694 times by 29 tests: available = nbytes;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
74694
765-
766#if defined (QNATIVESOCKETENGINE_DEBUG)-
767 qDebug("QNativeSocketEnginePrivate::nativeBytesAvailable() == %lli", available);-
768#endif-
769 return available > 0 ? available : 0;
executed 74694 times by 29 tests: return available > 0 ? available : 0;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
74694
770}-
771-
772bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const-
773{-
774 // Create a sockaddr struct and reset its port number.-
775 qt_sockaddr storage;-
776 QT_SOCKLEN_T storageSize = sizeof(storage);-
777 memset(&storage, 0, storageSize);-
778-
779 // Peek 0 bytes into the next message. The size of the message may-
780 // well be 0, so we can't check recvfrom's return value.-
781 ssize_t readBytes;-
782 do {-
783 char c;-
784 readBytes = ::recvfrom(socketDescriptor, &c, 1, MSG_PEEK, &storage.a, &storageSize);-
785 } while (readBytes == -1 && errno == EINTR);
executed 1079078 times by 3 tests: end of block
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
readBytes == -1Description
TRUEevaluated 853654 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
FALSEevaluated 225424 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
(*__errno_location ()) == 4Description
TRUEnever evaluated
FALSEevaluated 853654 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
0-1079078
786-
787 // If there's no error, or if our buffer was too small, there must be a-
788 // pending datagram.-
789 bool result = (readBytes != -1) || errno == EMSGSIZE;
(readBytes != -1)Description
TRUEevaluated 225424 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
FALSEevaluated 853654 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
(*__errno_location ()) == 90Description
TRUEnever evaluated
FALSEevaluated 853654 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
0-853654
790-
791#if defined (QNATIVESOCKETENGINE_DEBUG)-
792 qDebug("QNativeSocketEnginePrivate::nativeHasPendingDatagrams() == %s",-
793 result ? "true" : "false");-
794#endif-
795 return result;
executed 1079078 times by 3 tests: return result;
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
1079078
796}-
797-
798qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const-
799{-
800 QVarLengthArray<char, 8192> udpMessagePeekBuffer(8192);-
801 ssize_t recvResult = -1;-
802-
803 for (;;) {-
804 // the data written to udpMessagePeekBuffer is discarded, so-
805 // this function is still reentrant although it might not look-
806 // so.-
807 recvResult = ::recv(socketDescriptor, udpMessagePeekBuffer.data(),-
808 udpMessagePeekBuffer.size(), MSG_PEEK);-
809 if (recvResult == -1 && errno == EINTR)
recvResult == -1Description
TRUEnever evaluated
FALSEevaluated 731 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
(*__errno_location ()) == 4Description
TRUEnever evaluated
FALSEnever evaluated
0-731
810 continue;
never executed: continue;
0
811-
812 if (recvResult != (ssize_t) udpMessagePeekBuffer.size())
recvResult != ...kBuffer.size()Description
TRUEevaluated 595 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
FALSEevaluated 136 times by 1 test
Evaluated by:
  • tst_QUdpSocket
136-595
813 break;
executed 595 times by 3 tests: break;
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
595
814-
815 udpMessagePeekBuffer.resize(udpMessagePeekBuffer.size() * 2);-
816 }
executed 136 times by 1 test: end of block
Executed by:
  • tst_QUdpSocket
136
817-
818#if defined (QNATIVESOCKETENGINE_DEBUG)-
819 qDebug("QNativeSocketEnginePrivate::nativePendingDatagramSize() == %zd", recvResult);-
820#endif-
821-
822 return qint64(recvResult);
executed 595 times by 3 tests: return qint64(recvResult);
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
595
823}-
824-
825qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxSize, QIpPacketHeader *header,-
826 QAbstractSocketEngine::PacketHeaderOptions options)-
827{-
828 // we use quintptr to force the alignment-
829 quintptr cbuf[(CMSG_SPACE(sizeof(struct in6_pktinfo)) + CMSG_SPACE(sizeof(int))-
830#if !defined(IP_PKTINFO) && defined(IP_RECVIF) && defined(Q_OS_BSD4)-
831 + CMSG_SPACE(sizeof(sockaddr_dl))-
832#endif-
833 + sizeof(quintptr) - 1) / sizeof(quintptr)];-
834-
835 struct msghdr msg;-
836 struct iovec vec;-
837 qt_sockaddr aa;-
838 char c;-
839 memset(&msg, 0, sizeof(msg));-
840 memset(&aa, 0, sizeof(aa));-
841-
842 // we need to receive at least one byte, even if our user isn't interested in it-
843 vec.iov_base = maxSize ? data : &c;
maxSizeDescription
TRUEevaluated 854030 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
FALSEevaluated 186 times by 2 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_qsocks5socketengine - unknown status
186-854030
844 vec.iov_len = maxSize ? maxSize : 1;
maxSizeDescription
TRUEevaluated 854030 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
FALSEevaluated 186 times by 2 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_qsocks5socketengine - unknown status
186-854030
845 msg.msg_iov = &vec;-
846 msg.msg_iovlen = 1;-
847 if (options & QAbstractSocketEngine::WantDatagramSender) {
options & QAbs...DatagramSenderDescription
TRUEevaluated 509 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 853707 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
509-853707
848 msg.msg_name = &aa;-
849 msg.msg_namelen = sizeof(aa);-
850 }
executed 509 times by 3 tests: end of block
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocks5socketengine - unknown status
509
851 if (options & (QAbstractSocketEngine::WantDatagramHopLimit | QAbstractSocketEngine::WantDatagramDestination)) {
options & (QAb...amDestination)Description
TRUEnever evaluated
FALSEevaluated 854216 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
0-854216
852 msg.msg_control = cbuf;-
853 msg.msg_controllen = sizeof(cbuf);-
854 }
never executed: end of block
0
855-
856 ssize_t recvResult = 0;-
857 do {-
858 recvResult = ::recvmsg(socketDescriptor, &msg, 0);-
859 } while (recvResult == -1 && errno == EINTR);
executed 854216 times by 4 tests: end of block
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
recvResult == -1Description
TRUEnever evaluated
FALSEevaluated 854216 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
(*__errno_location ()) == 4Description
TRUEnever evaluated
FALSEnever evaluated
0-854216
860-
861 if (recvResult == -1) {
recvResult == -1Description
TRUEnever evaluated
FALSEevaluated 854216 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
0-854216
862 setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString);-
863 if (header)
headerDescription
TRUEnever evaluated
FALSEnever evaluated
0
864 header->clear();
never executed: header->clear();
0
865 } else if (options != QAbstractSocketEngine::WantNone) {
never executed: end of block
options != QAb...gine::WantNoneDescription
TRUEevaluated 509 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocks5socketengine - unknown status
FALSEevaluated 853707 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
0-853707
866 Q_ASSERT(header);-
867 qt_socket_getPortAndAddress(&aa, &header->senderPort, &header->senderAddress);-
868 header->destinationPort = localPort;-
869-
870 // parse the ancillary data-
871 struct cmsghdr *cmsgptr;-
872 for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL;
cmsgptr != __nullDescription
TRUEnever evaluated
FALSEevaluated 509 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocks5socketengine - unknown status
0-509
873 cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) {-
874 if (cmsgptr->cmsg_level == IPPROTO_IPV6 && cmsgptr->cmsg_type == IPV6_PKTINFO
cmsgptr->cmsg_...= IPPROTO_IPV6Description
TRUEnever evaluated
FALSEnever evaluated
cmsgptr->cmsg_type == 50Description
TRUEnever evaluated
FALSEnever evaluated
0
875 && cmsgptr->cmsg_len >= CMSG_LEN(sizeof(in6_pktinfo))) {
cmsgptr->cmsg_...in6_pktinfo)))Description
TRUEnever evaluated
FALSEnever evaluated
0
876 in6_pktinfo *info = reinterpret_cast<in6_pktinfo *>(CMSG_DATA(cmsgptr));-
877-
878 header->destinationAddress.setAddress(reinterpret_cast<quint8 *>(&info->ipi6_addr));-
879 header->ifindex = info->ipi6_ifindex;-
880 if (header->ifindex)
header->ifindexDescription
TRUEnever evaluated
FALSEnever evaluated
0
881 header->destinationAddress.setScopeId(QString::number(info->ipi6_ifindex));
never executed: header->destinationAddress.setScopeId(QString::number(info->ipi6_ifindex));
0
882 }
never executed: end of block
0
883-
884#ifdef IP_PKTINFO-
885 if (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_PKTINFO
cmsgptr->cmsg_... == IPPROTO_IPDescription
TRUEnever evaluated
FALSEnever evaluated
cmsgptr->cmsg_type == 8Description
TRUEnever evaluated
FALSEnever evaluated
0
886 && cmsgptr->cmsg_len >= CMSG_LEN(sizeof(in_pktinfo))) {
cmsgptr->cmsg_...(in_pktinfo)))Description
TRUEnever evaluated
FALSEnever evaluated
0
887 in_pktinfo *info = reinterpret_cast<in_pktinfo *>(CMSG_DATA(cmsgptr));-
888-
889 header->destinationAddress.setAddress(ntohl(info->ipi_addr.s_addr));-
890 header->ifindex = info->ipi_ifindex;-
891 }
never executed: end of block
0
892#else-
893# ifdef IP_RECVDSTADDR-
894 if (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_RECVDSTADDR-
895 && cmsgptr->cmsg_len >= CMSG_LEN(sizeof(in_addr))) {-
896 in_addr *addr = reinterpret_cast<in_addr *>(CMSG_DATA(cmsgptr));-
897-
898 header->destinationAddress.setAddress(ntohl(addr->s_addr));-
899 }-
900# endif-
901# if defined(IP_RECVIF) && defined(Q_OS_BSD4)-
902 if (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_RECVIF-
903 && cmsgptr->cmsg_len >= CMSG_LEN(sizeof(sockaddr_dl))) {-
904 sockaddr_dl *sdl = reinterpret_cast<sockaddr_dl *>(CMSG_DATA(cmsgptr));-
905 header->ifindex = sdl->sdl_index;-
906 }-
907# endif-
908#endif-
909-
910 if (cmsgptr->cmsg_len == CMSG_LEN(sizeof(int))
cmsgptr->cmsg_...(sizeof(int)))Description
TRUEnever evaluated
FALSEnever evaluated
0
911 && ((cmsgptr->cmsg_level == IPPROTO_IPV6 && cmsgptr->cmsg_type == IPV6_HOPLIMIT)
cmsgptr->cmsg_...= IPPROTO_IPV6Description
TRUEnever evaluated
FALSEnever evaluated
cmsgptr->cmsg_type == 52Description
TRUEnever evaluated
FALSEnever evaluated
0
912 || (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_TTL))) {
cmsgptr->cmsg_... == IPPROTO_IPDescription
TRUEnever evaluated
FALSEnever evaluated
cmsgptr->cmsg_type == 2Description
TRUEnever evaluated
FALSEnever evaluated
0
913 header->hopLimit = *reinterpret_cast<int *>(CMSG_DATA(cmsgptr));-
914 }
never executed: end of block
0
915 }
never executed: end of block
0
916 }
executed 509 times by 3 tests: end of block
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocks5socketengine - unknown status
509
917-
918#if defined (QNATIVESOCKETENGINE_DEBUG)-
919 qDebug("QNativeSocketEnginePrivate::nativeReceiveDatagram(%p \"%s\", %lli, %s, %i) == %lli",-
920 data, qt_prettyDebug(data, qMin(recvResult, ssize_t(16)), recvResult).data(), maxSize,-
921 (recvResult != -1 && options != QAbstractSocketEngine::WantNone)-
922 ? header->senderAddress.toString().toLatin1().constData() : "(unknown)",-
923 (recvResult != -1 && options != QAbstractSocketEngine::WantNone)-
924 ? header->senderPort : 0, (qint64) recvResult);-
925#endif-
926-
927 return qint64(maxSize ? recvResult : recvResult == -1 ? -1 : 0);
executed 854216 times by 4 tests: return qint64(maxSize ? recvResult : recvResult == -1 ? -1 : 0);
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
854216
928}-
929-
930qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 len, const QIpPacketHeader &header)-
931{-
932 // we use quintptr to force the alignment-
933 quintptr cbuf[(CMSG_SPACE(sizeof(struct in6_pktinfo)) + CMSG_SPACE(sizeof(int)) + sizeof(quintptr) - 1) / sizeof(quintptr)];-
934-
935 struct cmsghdr *cmsgptr = reinterpret_cast<struct cmsghdr *>(cbuf);-
936 struct msghdr msg;-
937 struct iovec vec;-
938 qt_sockaddr aa;-
939-
940 memset(&msg, 0, sizeof(msg));-
941 memset(&aa, 0, sizeof(aa));-
942 vec.iov_base = const_cast<char *>(data);-
943 vec.iov_len = len;-
944 msg.msg_iov = &vec;-
945 msg.msg_iovlen = 1;-
946 msg.msg_name = &aa.a;-
947 msg.msg_control = &cbuf;-
948-
949 setPortAndAddress(header.destinationPort, header.destinationAddress, &aa, &msg.msg_namelen);-
950-
951 if (msg.msg_namelen == sizeof(aa.a6)) {
msg.msg_namele... sizeof(aa.a6)Description
TRUEevaluated 151 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
FALSEevaluated 485 times by 2 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_qsocks5socketengine - unknown status
151-485
952 if (header.hopLimit != -1) {
header.hopLimit != -1Description
TRUEnever evaluated
FALSEevaluated 151 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
0-151
953 msg.msg_controllen += CMSG_SPACE(sizeof(int));-
954 cmsgptr->cmsg_len = CMSG_LEN(sizeof(int));-
955 cmsgptr->cmsg_level = IPPROTO_IPV6;-
956 cmsgptr->cmsg_type = IPV6_HOPLIMIT;-
957 memcpy(CMSG_DATA(cmsgptr), &header.hopLimit, sizeof(int));-
958 cmsgptr = reinterpret_cast<cmsghdr *>(reinterpret_cast<char *>(cmsgptr) + CMSG_SPACE(sizeof(int)));-
959 }
never executed: end of block
0
960 if (header.ifindex != 0 || !header.senderAddress.isNull()) {
header.ifindex != 0Description
TRUEnever evaluated
FALSEevaluated 151 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
!header.senderAddress.isNull()Description
TRUEnever evaluated
FALSEevaluated 151 times by 3 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
0-151
961 struct in6_pktinfo *data = reinterpret_cast<in6_pktinfo *>(CMSG_DATA(cmsgptr));-
962 memset(data, 0, sizeof(*data));-
963 msg.msg_controllen += CMSG_SPACE(sizeof(*data));-
964 cmsgptr->cmsg_len = CMSG_LEN(sizeof(*data));-
965 cmsgptr->cmsg_level = IPPROTO_IPV6;-
966 cmsgptr->cmsg_type = IPV6_PKTINFO;-
967 data->ipi6_ifindex = header.ifindex;-
968-
969 QIPv6Address tmp = header.senderAddress.toIPv6Address();-
970 memcpy(&data->ipi6_addr, &tmp, sizeof(tmp));-
971 cmsgptr = reinterpret_cast<cmsghdr *>(reinterpret_cast<char *>(cmsgptr) + CMSG_SPACE(sizeof(*data)));-
972 }
never executed: end of block
0
973 } else {
executed 151 times by 3 tests: end of block
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
151
974 if (header.hopLimit != -1) {
header.hopLimit != -1Description
TRUEnever evaluated
FALSEevaluated 485 times by 2 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_qsocks5socketengine - unknown status
0-485
975 msg.msg_controllen += CMSG_SPACE(sizeof(int));-
976 cmsgptr->cmsg_len = CMSG_LEN(sizeof(int));-
977 cmsgptr->cmsg_level = IPPROTO_IP;-
978 cmsgptr->cmsg_type = IP_TTL;-
979 memcpy(CMSG_DATA(cmsgptr), &header.hopLimit, sizeof(int));-
980 cmsgptr = reinterpret_cast<cmsghdr *>(reinterpret_cast<char *>(cmsgptr) + CMSG_SPACE(sizeof(int)));-
981 }
never executed: end of block
0
982-
983#if defined(IP_PKTINFO) || defined(IP_SENDSRCADDR)-
984 if (header.ifindex != 0 || !header.senderAddress.isNull()) {
header.ifindex != 0Description
TRUEnever evaluated
FALSEevaluated 485 times by 2 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_qsocks5socketengine - unknown status
!header.senderAddress.isNull()Description
TRUEnever evaluated
FALSEevaluated 485 times by 2 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_qsocks5socketengine - unknown status
0-485
985# ifdef IP_PKTINFO-
986 struct in_pktinfo *data = reinterpret_cast<in_pktinfo *>(CMSG_DATA(cmsgptr));-
987 memset(data, 0, sizeof(*data));-
988 cmsgptr->cmsg_type = IP_PKTINFO;-
989 data->ipi_ifindex = header.ifindex;-
990 data->ipi_addr.s_addr = htonl(header.senderAddress.toIPv4Address());-
991# elif defined(IP_SENDSRCADDR)-
992 struct in_addr *data = reinterpret_cast<in_addr *>(CMSG_DATA(cmsgptr));-
993 cmsgptr->cmsg_type = IP_SENDSRCADDR;-
994 data->s_addr = htonl(header.senderAddress.toIPv4Address());-
995# endif-
996 cmsgptr->cmsg_level = IPPROTO_IP;-
997 msg.msg_controllen += CMSG_SPACE(sizeof(*data));-
998 cmsgptr->cmsg_len = CMSG_LEN(sizeof(*data));-
999 cmsgptr = reinterpret_cast<cmsghdr *>(reinterpret_cast<char *>(cmsgptr) + CMSG_SPACE(sizeof(*data)));-
1000 }
never executed: end of block
0
1001#endif-
1002 }
executed 485 times by 2 tests: end of block
Executed by:
  • tst_QUdpSocket
  • tst_qsocks5socketengine - unknown status
485
1003-
1004 if (msg.msg_controllen == 0)
msg.msg_controllen == 0Description
TRUEevaluated 636 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-636
1005 msg.msg_control = 0;
executed 636 times by 4 tests: msg.msg_control = 0;
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
636
1006 ssize_t sentBytes = qt_safe_sendmsg(socketDescriptor, &msg, 0);-
1007-
1008 if (sentBytes < 0) {
sentBytes < 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUdpSocket
FALSEevaluated 635 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
1-635
1009 switch (errno) {-
1010 case EMSGSIZE:
executed 1 time by 1 test: case 90:
Executed by:
  • tst_QUdpSocket
1
1011 setError(QAbstractSocket::DatagramTooLargeError, DatagramTooLargeErrorString);-
1012 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QUdpSocket
1
1013 default:
never executed: default:
0
1014 setError(QAbstractSocket::NetworkError, SendDatagramErrorString);-
1015 }
never executed: end of block
0
1016 }-
1017-
1018#if defined (QNATIVESOCKETENGINE_DEBUG)-
1019 qDebug("QNativeSocketEngine::sendDatagram(%p \"%s\", %lli, \"%s\", %i) == %lli", data,-
1020 qt_prettyDebug(data, qMin<int>(len, 16), len).data(), len,-
1021 header.destinationAddress.toString().toLatin1().constData(),-
1022 header.destinationPort, (qint64) sentBytes);-
1023#endif-
1024-
1025 return qint64(sentBytes);
executed 636 times by 4 tests: return qint64(sentBytes);
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
636
1026}-
1027-
1028bool QNativeSocketEnginePrivate::fetchConnectionParameters()-
1029{-
1030 localPort = 0;-
1031 localAddress.clear();-
1032 peerPort = 0;-
1033 peerAddress.clear();-
1034 inboundStreamCount = outboundStreamCount = 0;-
1035-
1036 if (socketDescriptor == -1)
socketDescriptor == -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
FALSEevaluated 5240 times by 31 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • ...
1-5240
1037 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_qlocalsocket - unknown status
1
1038-
1039 qt_sockaddr sa;-
1040 QT_SOCKLEN_T sockAddrSize = sizeof(sa);-
1041-
1042 // Determine local address-
1043 memset(&sa, 0, sizeof(sa));-
1044 if (::getsockname(socketDescriptor, &sa.a, &sockAddrSize) == 0) {
::getsockname(...AddrSize) == 0Description
TRUEevaluated 5232 times by 31 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • ...
FALSEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qtcpsocket - unknown status
8-5232
1045 qt_socket_getPortAndAddress(&sa, &localPort, &localAddress);-
1046-
1047 // Determine protocol family-
1048 switch (sa.a.sa_family) {-
1049 case AF_INET:
executed 3867 times by 28 tests: case 2:
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • ...
3867
1050 socketProtocol = QAbstractSocket::IPv4Protocol;-
1051 break;
executed 3867 times by 28 tests: break;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • ...
3867
1052 case AF_INET6:
executed 1207 times by 14 tests: case 10:
Executed by:
  • tst_NetworkSelfTest
  • tst_QHostInfo
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
1207
1053 socketProtocol = QAbstractSocket::IPv6Protocol;-
1054 break;
executed 1207 times by 14 tests: break;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHostInfo
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
1207
1055 default:
executed 158 times by 3 tests: default:
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
158
1056 socketProtocol = QAbstractSocket::UnknownNetworkLayerProtocol;-
1057 break;
executed 158 times by 3 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
158
1058 }-
1059-
1060 } else if (errno == EBADF) {
(*__errno_location ()) == 9Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QTcpServer
  • tst_qtcpsocket - unknown status
FALSEnever evaluated
0-8
1061 setError(QAbstractSocket::UnsupportedSocketOperationError, InvalidSocketErrorString);-
1062 return false;
executed 8 times by 2 tests: return false;
Executed by:
  • tst_QTcpServer
  • tst_qtcpsocket - unknown status
8
1063 }-
1064-
1065#if defined (IPV6_V6ONLY)-
1066 // determine if local address is dual mode-
1067 // On linux, these are returned as "::" (==AnyIPv6)-
1068 // On OSX, these are returned as "::FFFF:0.0.0.0" (==AnyIPv4)-
1069 // in either case, the IPV6_V6ONLY option is cleared-
1070 int ipv6only = 0;-
1071 socklen_t optlen = sizeof(ipv6only);-
1072 if (socketProtocol == QAbstractSocket::IPv6Protocol
socketProtocol...::IPv6ProtocolDescription
TRUEevaluated 1207 times by 14 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHostInfo
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEevaluated 4025 times by 30 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • ...
1207-4025
1073 && (localAddress == QHostAddress::AnyIPv4 || localAddress == QHostAddress::AnyIPv6)
localAddress =...dress::AnyIPv4Description
TRUEnever evaluated
FALSEevaluated 1207 times by 14 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHostInfo
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
localAddress =...dress::AnyIPv6Description
TRUEevaluated 616 times by 13 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEevaluated 591 times by 12 tests
Evaluated by:
  • tst_QHostInfo
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
0-1207
1074 && !getsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&ipv6only, &optlen )) {
!getsockopt(so...nly, &optlen )Description
TRUEevaluated 616 times by 13 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEnever evaluated
0-616
1075 if (optlen != sizeof(ipv6only))
optlen != sizeof(ipv6only)Description
TRUEnever evaluated
FALSEevaluated 616 times by 13 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
0-616
1076 qWarning("unexpected size of IPV6_V6ONLY socket option");
never executed: QMessageLogger(__FILE__, 1076, __PRETTY_FUNCTION__).warning("unexpected size of IPV6_V6ONLY socket option");
0
1077 if (!ipv6only) {
!ipv6onlyDescription
TRUEevaluated 580 times by 13 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEevaluated 36 times by 5 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qtcpsocket - unknown status
36-580
1078 socketProtocol = QAbstractSocket::AnyIPProtocol;-
1079 localAddress = QHostAddress::Any;-
1080 }
executed 580 times by 13 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
580
1081 }
executed 616 times by 13 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
616
1082#endif-
1083-
1084 // Determine the remote address-
1085 if (!::getpeername(socketDescriptor, &sa.a, &sockAddrSize)) {
!::getpeername...&sockAddrSize)Description
TRUEevaluated 4297 times by 30 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • ...
FALSEevaluated 935 times by 20 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
935-4297
1086 qt_socket_getPortAndAddress(&sa, &peerPort, &peerAddress);-
1087 inboundStreamCount = outboundStreamCount = 1;-
1088 }
executed 4297 times by 30 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • ...
4297
1089-
1090 // Determine the socket type (UDP/TCP)-
1091 int value = 0;-
1092 QT_SOCKOPTLEN_T valueSize = sizeof(int);-
1093 if (::getsockopt(socketDescriptor, SOL_SOCKET, SO_TYPE, &value, &valueSize) == 0) {
::getsockopt(s...alueSize) == 0Description
TRUEevaluated 5232 times by 31 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • ...
FALSEnever evaluated
0-5232
1094 if (value == SOCK_STREAM)
value == SOCK_STREAMDescription
TRUEevaluated 5092 times by 31 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • ...
FALSEevaluated 140 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
140-5092
1095 socketType = QAbstractSocket::TcpSocket;
executed 5092 times by 31 tests: socketType = QAbstractSocket::TcpSocket;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • ...
5092
1096 else if (value == SOCK_DGRAM)
value == SOCK_DGRAMDescription
TRUEevaluated 140 times by 4 tests
Evaluated by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
FALSEnever evaluated
0-140
1097 socketType = QAbstractSocket::UdpSocket;
executed 140 times by 4 tests: socketType = QAbstractSocket::UdpSocket;
Executed by:
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
140
1098 else-
1099 socketType = QAbstractSocket::UnknownSocketType;
never executed: socketType = QAbstractSocket::UnknownSocketType;
0
1100 }-
1101#if defined (QNATIVESOCKETENGINE_DEBUG)-
1102 QString socketProtocolStr = QStringLiteral("UnknownProtocol");-
1103 if (socketProtocol == QAbstractSocket::IPv4Protocol) socketProtocolStr = QStringLiteral("IPv4Protocol");-
1104 else if (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) socketProtocolStr = QStringLiteral("IPv6Protocol");-
1105-
1106 QString socketTypeStr = QStringLiteral("UnknownSocketType");-
1107 if (socketType == QAbstractSocket::TcpSocket) socketTypeStr = QStringLiteral("TcpSocket");-
1108 else if (socketType == QAbstractSocket::UdpSocket) socketTypeStr = QStringLiteral("UdpSocket");-
1109-
1110 qDebug("QNativeSocketEnginePrivate::fetchConnectionParameters() local == %s:%i,"-
1111 " peer == %s:%i, socket == %s - %s, inboundStreamCount == %i, outboundStreamCount == %i",-
1112 localAddress.toString().toLatin1().constData(), localPort,-
1113 peerAddress.toString().toLatin1().constData(), peerPort,socketTypeStr.toLatin1().constData(),-
1114 socketProtocolStr.toLatin1().constData(), inboundStreamCount, outboundStreamCount);-
1115#endif-
1116 return true;
executed 5232 times by 31 tests: return true;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • ...
5232
1117}-
1118-
1119void QNativeSocketEnginePrivate::nativeClose()-
1120{-
1121#if defined (QNATIVESOCKETENGINE_DEBUG)-
1122 qDebug("QNativeSocketEngine::nativeClose()");-
1123#endif-
1124-
1125 qt_safe_close(socketDescriptor);-
1126}
executed 71284 times by 32 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • ...
71284
1127-
1128qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len)-
1129{-
1130 Q_Q(QNativeSocketEngine);-
1131-
1132 ssize_t writtenBytes;-
1133 writtenBytes = qt_safe_write_nosignal(socketDescriptor, data, len);-
1134-
1135 if (writtenBytes < 0) {
writtenBytes < 0Description
TRUEevaluated 199 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 912945 times by 27 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • ...
199-912945
1136 switch (errno) {-
1137 case EPIPE:
executed 1 time by 1 test: case 32:
Executed by:
  • tst_qtcpsocket - unknown status
1
1138 case ECONNRESET:
never executed: case 104:
0
1139 writtenBytes = -1;-
1140 setError(QAbstractSocket::RemoteHostClosedError, RemoteHostClosedErrorString);-
1141 q->close();-
1142 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_qtcpsocket - unknown status
1
1143 case EAGAIN:
executed 198 times by 2 tests: case 11:
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
198
1144 writtenBytes = 0;-
1145 break;
executed 198 times by 2 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
198
1146 case EMSGSIZE:
never executed: case 90:
0
1147 setError(QAbstractSocket::DatagramTooLargeError, DatagramTooLargeErrorString);-
1148 break;
never executed: break;
0
1149 default:
never executed: default:
0
1150 break;
never executed: break;
0
1151 }-
1152 }-
1153-
1154#if defined (QNATIVESOCKETENGINE_DEBUG)-
1155 qDebug("QNativeSocketEnginePrivate::nativeWrite(%p \"%s\", %llu) == %i",-
1156 data, qt_prettyDebug(data, qMin((int) len, 16),-
1157 (int) len).data(), len, (int) writtenBytes);-
1158#endif-
1159-
1160 return qint64(writtenBytes);
executed 913144 times by 27 tests: return qint64(writtenBytes);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • ...
913144
1161}-
1162/*-
1163*/-
1164qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize)-
1165{-
1166 Q_Q(QNativeSocketEngine);-
1167 if (!q->isValid()) {
!q->isValid()Description
TRUEnever evaluated
FALSEevaluated 193247 times by 29 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
0-193247
1168 qWarning("QNativeSocketEngine::nativeRead: Invalid socket");-
1169 return -1;
never executed: return -1;
0
1170 }-
1171-
1172 ssize_t r = 0;-
1173 r = qt_safe_read(socketDescriptor, data, maxSize);-
1174-
1175 if (r < 0) {
r < 0Description
TRUEevaluated 1199 times by 5 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QNetworkReply
  • tst_platformsocketengine - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qtcpsocket - unknown status
FALSEevaluated 192048 times by 29 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
1199-192048
1176 r = -1;-
1177 switch (errno) {-
1178#if EWOULDBLOCK-0 && EWOULDBLOCK != EAGAIN-
1179 case EWOULDBLOCK:-
1180#endif-
1181 case EAGAIN:
executed 1177 times by 2 tests: case 11:
Executed by:
  • tst_QNetworkReply
  • tst_qsocketnotifier - unknown status
1177
1182 // No data was available for reading-
1183 r = -2;-
1184 break;
executed 1177 times by 2 tests: break;
Executed by:
  • tst_QNetworkReply
  • tst_qsocketnotifier - unknown status
1177
1185 case EBADF:
executed 1 time by 1 test: case 9:
Executed by:
  • tst_platformsocketengine - unknown status
1
1186 case EINVAL:
never executed: case 22:
0
1187 case EIO:
never executed: case 5:
0
1188 //error string is now set in read(), not here in nativeRead()-
1189 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_platformsocketengine - unknown status
1
1190 case ECONNRESET:
executed 21 times by 3 tests: case 104:
Executed by:
  • tst_NetworkSelfTest
  • tst_QNetworkReply
  • tst_qtcpsocket - unknown status
21
1191#if defined(Q_OS_VXWORKS)-
1192 case ESHUTDOWN:-
1193#endif-
1194 r = 0;-
1195 break;
executed 21 times by 3 tests: break;
Executed by:
  • tst_NetworkSelfTest
  • tst_QNetworkReply
  • tst_qtcpsocket - unknown status
21
1196 default:
never executed: default:
0
1197 break;
never executed: break;
0
1198 }-
1199 }-
1200-
1201#if defined (QNATIVESOCKETENGINE_DEBUG)-
1202 qDebug("QNativeSocketEnginePrivate::nativeRead(%p \"%s\", %llu) == %zd",-
1203 data, qt_prettyDebug(data, qMin(r, ssize_t(16)), r).data(),-
1204 maxSize, r);-
1205#endif-
1206-
1207 return qint64(r);
executed 193247 times by 29 tests: return qint64(r);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qimagereader - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • ...
193247
1208}-
1209-
1210int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) const-
1211{-
1212 bool dummy;-
1213 return nativeSelect(timeout, selectForRead, !selectForRead, &dummy, &dummy);
executed 262400 times by 20 tests: return nativeSelect(timeout, selectForRead, !selectForRead, &dummy, &dummy);
Executed by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QNetworkInterface
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qtextstream - unknown status
  • tst_qxmlsimplereader - unknown status
262400
1214}-
1215-
1216int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool checkWrite,-
1217 bool *selectForRead, bool *selectForWrite) const-
1218{-
1219 pollfd pfd = qt_make_pollfd(socketDescriptor, 0);-
1220-
1221 if (checkRead)
checkReadDescription
TRUEevaluated 275986 times by 23 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QNetworkInterface
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qtextstream - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEevaluated 1102 times by 20 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QNetworkInterface
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qiodevice - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qtextstream - unknown status
  • tst_qxmlsimplereader - unknown status
1102-275986
1222 pfd.events |= POLLIN;
executed 275986 times by 23 tests: pfd.events |= 0x001;
Executed by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QNetworkInterface
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qtextstream - unknown status
  • tst_qxmlsimplereader - unknown status
275986
1223-
1224 if (checkWrite)
checkWriteDescription
TRUEevaluated 10869 times by 22 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QNetworkInterface
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qtextstream - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEevaluated 266219 times by 19 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_platformsocketengine - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qtextstream - unknown status
  • tst_qxmlsimplereader - unknown status
10869-266219
1225 pfd.events |= POLLOUT;
executed 10869 times by 22 tests: pfd.events |= 0x004;
Executed by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QNetworkInterface
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qtextstream - unknown status
  • tst_qxmlsimplereader - unknown status
10869
1226-
1227 const int ret = qt_poll_msecs(&pfd, 1, timeout);-
1228-
1229 if (ret <= 0)
ret <= 0Description
TRUEevaluated 138 times by 10 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_qlocalsocket - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
FALSEevaluated 276950 times by 23 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QNetworkInterface
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qtextstream - unknown status
  • tst_qxmlsimplereader - unknown status
138-276950
1230 return ret;
executed 138 times by 10 tests: return ret;
Executed by:
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_qlocalsocket - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qxmlsimplereader - unknown status
138
1231-
1232 if (pfd.revents & POLLNVAL) {
pfd.revents & 0x020Description
TRUEnever evaluated
FALSEevaluated 276950 times by 23 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QNetworkInterface
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qtextstream - unknown status
  • tst_qxmlsimplereader - unknown status
0-276950
1233 errno = EBADF;-
1234 return -1;
never executed: return -1;
0
1235 }-
1236-
1237 static const short read_flags = POLLIN | POLLHUP | POLLERR;-
1238 static const short write_flags = POLLOUT | POLLERR;-
1239-
1240 *selectForRead = ((pfd.revents & read_flags) != 0);-
1241 *selectForWrite = ((pfd.revents & write_flags) != 0);-
1242-
1243 return ret;
executed 276950 times by 23 tests: return ret;
Executed by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QNetworkInterface
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_QTcpServer
  • tst_QUdpSocket
  • tst_Spdy
  • tst_platformsocketengine - unknown status
  • tst_qeventloop - unknown status
  • tst_qguieventloop - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qiodevice - unknown status
  • tst_qlocalsocket - unknown status
  • tst_qobject - unknown status
  • tst_qsocketnotifier - unknown status
  • tst_qsocks5socketengine - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
  • tst_qtcpsocket - unknown status
  • tst_qtextstream - unknown status
  • tst_qxmlsimplereader - unknown status
276950
1244}-
1245-
1246QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

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