socket/qabstractsocketengine.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6class QSocketEngineHandlerList : public QList<QSocketEngineHandler*> -
7{ -
8public: -
9 QMutex mutex; -
10}; -
11 -
12static QSocketEngineHandlerList *socketHandlers() { static QGlobalStatic<QSocketEngineHandlerList > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QSocketEngineHandlerList *x = new QSocketEngineHandlerList; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QSocketEngineHandlerList > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:21227
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:23
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:21204
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:23
no
Evaluation Count:0
0-21227
13 -
14QSocketEngineHandler::QSocketEngineHandler() -
15{ -
16 if (!socketHandlers())
partially evaluated: !socketHandlers()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:46
0-46
17 return;
never executed: return;
0
18 QMutexLocker locker(&socketHandlers()->mutex); -
19 socketHandlers()->prepend(this); -
20}
executed: }
Execution Count:46
46
21 -
22QSocketEngineHandler::~QSocketEngineHandler() -
23{ -
24 if (!socketHandlers())
partially evaluated: !socketHandlers()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:46
0-46
25 return;
never executed: return;
0
26 QMutexLocker locker(&socketHandlers()->mutex); -
27 socketHandlers()->removeAll(this); -
28}
executed: }
Execution Count:46
46
29 -
30QAbstractSocketEnginePrivate::QAbstractSocketEnginePrivate() -
31 : socketError(QAbstractSocket::UnknownSocketError) -
32 , hasSetSocketError(false) -
33 , socketErrorString(QLatin1String("Unknown error")) -
34 , socketState(QAbstractSocket::UnconnectedState) -
35 , socketType(QAbstractSocket::UnknownSocketType) -
36 , socketProtocol(QAbstractSocket::UnknownNetworkLayerProtocol) -
37 , localPort(0) -
38 , peerPort(0) -
39 , receiver(0) -
40{ -
41}
executed: }
Execution Count:3522
3522
42 -
43QAbstractSocketEngine::QAbstractSocketEngine(QObject *parent) -
44 : QObject(*new QAbstractSocketEnginePrivate(), parent) -
45{ -
46}
never executed: }
0
47 -
48QAbstractSocketEngine::QAbstractSocketEngine(QAbstractSocketEnginePrivate &dd, QObject* parent) -
49 : QObject(dd, parent) -
50{ -
51}
executed: }
Execution Count:3522
3522
52 -
53QAbstractSocketEngine *QAbstractSocketEngine::createSocketEngine(QAbstractSocket::SocketType socketType, const QNetworkProxy &proxy, QObject *parent) -
54{ -
55 -
56 -
57 if (proxy.type() == QNetworkProxy::DefaultProxy)
evaluated: proxy.type() == QNetworkProxy::DefaultProxy
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2906
6-2906
58 return 0;
executed: return 0;
Execution Count:6
6
59 -
60 -
61 QMutexLocker locker(&socketHandlers()->mutex); -
62 for (int i = 0; i < socketHandlers()->size(); i++) {
evaluated: i < socketHandlers()->size()
TRUEFALSE
yes
Evaluation Count:5795
yes
Evaluation Count:2761
2761-5795
63 if (QAbstractSocketEngine *ret = socketHandlers()->at(i)->createSocketEngine(socketType, proxy, parent))
evaluated: QAbstractSocketEngine *ret = socketHandlers()->at(i)->createSocketEngine(socketType, proxy, parent)
TRUEFALSE
yes
Evaluation Count:145
yes
Evaluation Count:5650
145-5650
64 return ret;
executed: return ret;
Execution Count:145
145
65 }
executed: }
Execution Count:5650
5650
66 -
67 -
68 -
69 if (proxy.type() != QNetworkProxy::NoProxy)
partially evaluated: proxy.type() != QNetworkProxy::NoProxy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2761
0-2761
70 return 0;
never executed: return 0;
0
71 -
72 -
73 return new QNativeSocketEngine(parent);
executed: return new QNativeSocketEngine(parent);
Execution Count:2761
2761
74} -
75 -
76QAbstractSocketEngine *QAbstractSocketEngine::createSocketEngine(qintptr socketDescripter, QObject *parent) -
77{ -
78 QMutexLocker locker(&socketHandlers()->mutex); -
79 for (int i = 0; i < socketHandlers()->size(); i++) {
evaluated: i < socketHandlers()->size()
TRUEFALSE
yes
Evaluation Count:1232
yes
Evaluation Count:615
615-1232
80 if (QAbstractSocketEngine *ret = socketHandlers()->at(i)->createSocketEngine(socketDescripter, parent))
evaluated: QAbstractSocketEngine *ret = socketHandlers()->at(i)->createSocketEngine(socketDescripter, parent)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1231
1-1231
81 return ret;
executed: return ret;
Execution Count:1
1
82 }
executed: }
Execution Count:1231
1231
83 return new QNativeSocketEngine(parent);
executed: return new QNativeSocketEngine(parent);
Execution Count:615
615
84} -
85 -
86QAbstractSocket::SocketError QAbstractSocketEngine::error() const -
87{ -
88 return d_func()->socketError;
executed: return d_func()->socketError;
Execution Count:942
942
89} -
90 -
91QString QAbstractSocketEngine::errorString() const -
92{ -
93 return d_func()->socketErrorString;
executed: return d_func()->socketErrorString;
Execution Count:460
460
94} -
95 -
96void QAbstractSocketEngine::setError(QAbstractSocket::SocketError error, const QString &errorString) const -
97{ -
98 const QAbstractSocketEnginePrivate * const d = d_func(); -
99 d->socketError = error; -
100 d->socketErrorString = errorString; -
101}
executed: }
Execution Count:44
44
102 -
103void QAbstractSocketEngine::setReceiver(QAbstractSocketEngineReceiver *receiver) -
104{ -
105 d_func()->receiver = receiver; -
106}
executed: }
Execution Count:3508
3508
107 -
108void QAbstractSocketEngine::readNotification() -
109{ -
110 if (QAbstractSocketEngineReceiver *receiver = d_func()->receiver)
partially evaluated: QAbstractSocketEngineReceiver *receiver = d_func()->receiver
TRUEFALSE
yes
Evaluation Count:9772
no
Evaluation Count:0
0-9772
111 receiver->readNotification();
executed: receiver->readNotification();
Execution Count:9772
9772
112}
executed: }
Execution Count:9772
9772
113 -
114void QAbstractSocketEngine::writeNotification() -
115{ -
116 if (QAbstractSocketEngineReceiver *receiver = d_func()->receiver)
partially evaluated: QAbstractSocketEngineReceiver *receiver = d_func()->receiver
TRUEFALSE
yes
Evaluation Count:7469
no
Evaluation Count:0
0-7469
117 receiver->writeNotification();
executed: receiver->writeNotification();
Execution Count:7469
7469
118}
executed: }
Execution Count:7469
7469
119 -
120void QAbstractSocketEngine::exceptionNotification() -
121{ -
122 if (QAbstractSocketEngineReceiver *receiver = d_func()->receiver)
never evaluated: QAbstractSocketEngineReceiver *receiver = d_func()->receiver
0
123 receiver->exceptionNotification();
never executed: receiver->exceptionNotification();
0
124}
never executed: }
0
125 -
126void QAbstractSocketEngine::closeNotification() -
127{ -
128 if (QAbstractSocketEngineReceiver *receiver = d_func()->receiver)
never evaluated: QAbstractSocketEngineReceiver *receiver = d_func()->receiver
0
129 receiver->closeNotification();
never executed: receiver->closeNotification();
0
130}
never executed: }
0
131 -
132void QAbstractSocketEngine::connectionNotification() -
133{ -
134 if (QAbstractSocketEngineReceiver *receiver = d_func()->receiver)
partially evaluated: QAbstractSocketEngineReceiver *receiver = d_func()->receiver
TRUEFALSE
yes
Evaluation Count:839
no
Evaluation Count:0
0-839
135 receiver->connectionNotification();
executed: receiver->connectionNotification();
Execution Count:839
839
136}
executed: }
Execution Count:839
839
137 -
138 -
139void QAbstractSocketEngine::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator) -
140{ -
141 if (QAbstractSocketEngineReceiver *receiver = d_func()->receiver)
partially evaluated: QAbstractSocketEngineReceiver *receiver = d_func()->receiver
TRUEFALSE
yes
Evaluation Count:33
no
Evaluation Count:0
0-33
142 receiver->proxyAuthenticationRequired(proxy, authenticator);
executed: receiver->proxyAuthenticationRequired(proxy, authenticator);
Execution Count:33
33
143}
executed: }
Execution Count:33
33
144 -
145 -
146 -
147QAbstractSocket::SocketState QAbstractSocketEngine::state() const -
148{ -
149 return d_func()->socketState;
executed: return d_func()->socketState;
Execution Count:31640
31640
150} -
151 -
152void QAbstractSocketEngine::setState(QAbstractSocket::SocketState state) -
153{ -
154 d_func()->socketState = state; -
155}
executed: }
Execution Count:217
217
156 -
157QAbstractSocket::SocketType QAbstractSocketEngine::socketType() const -
158{ -
159 return d_func()->socketType;
executed: return d_func()->socketType;
Execution Count:199
199
160} -
161 -
162void QAbstractSocketEngine::setSocketType(QAbstractSocket::SocketType socketType) -
163{ -
164 d_func()->socketType = socketType; -
165}
executed: }
Execution Count:17
17
166 -
167QAbstractSocket::NetworkLayerProtocol QAbstractSocketEngine::protocol() const -
168{ -
169 return d_func()->socketProtocol;
executed: return d_func()->socketProtocol;
Execution Count:442
442
170} -
171 -
172void QAbstractSocketEngine::setProtocol(QAbstractSocket::NetworkLayerProtocol protocol) -
173{ -
174 d_func()->socketProtocol = protocol; -
175}
executed: }
Execution Count:17
17
176 -
177QHostAddress QAbstractSocketEngine::localAddress() const -
178{ -
179 return d_func()->localAddress;
executed: return d_func()->localAddress;
Execution Count:2591
2591
180} -
181 -
182void QAbstractSocketEngine::setLocalAddress(const QHostAddress &address) -
183{ -
184 d_func()->localAddress = address; -
185}
executed: }
Execution Count:15
15
186 -
187quint16 QAbstractSocketEngine::localPort() const -
188{ -
189 return d_func()->localPort;
executed: return d_func()->localPort;
Execution Count:3005
3005
190} -
191 -
192void QAbstractSocketEngine::setLocalPort(quint16 port) -
193{ -
194 d_func()->localPort = port; -
195}
executed: }
Execution Count:15
15
196 -
197QHostAddress QAbstractSocketEngine::peerAddress() const -
198{ -
199 return d_func()->peerAddress;
executed: return d_func()->peerAddress;
Execution Count:1863
1863
200} -
201 -
202void QAbstractSocketEngine::setPeerAddress(const QHostAddress &address) -
203{ -
204 d_func()->peerAddress = address; -
205}
executed: }
Execution Count:68
68
206 -
207quint16 QAbstractSocketEngine::peerPort() const -
208{ -
209 return d_func()->peerPort;
executed: return d_func()->peerPort;
Execution Count:1863
1863
210} -
211 -
212void QAbstractSocketEngine::setPeerPort(quint16 port) -
213{ -
214 d_func()->peerPort = port; -
215}
executed: }
Execution Count:68
68
216 -
217 -
218 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial