socket/qlocalserver.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3QLocalServer::QLocalServer(QObject *parent) -
4 : QObject(*new QLocalServerPrivate, parent) -
5{ -
6 QLocalServerPrivate * const d = d_func(); -
7 d->init(); -
8}
executed: }
Execution Count:55
55
9QLocalServer::~QLocalServer() -
10{ -
11 if (isListening())
evaluated: isListening()
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:18
18-37
12 close();
executed: close();
Execution Count:37
37
13}
executed: }
Execution Count:55
55
14void QLocalServer::setSocketOptions(SocketOptions options) -
15{ -
16 QLocalServerPrivate * const d = d_func(); -
17 -
18 d->socketOptions = options; -
19}
executed: }
Execution Count:4
4
20 -
21 -
22 -
23 -
24 -
25 -
26 -
27QLocalServer::SocketOptions QLocalServer::socketOptions() const -
28{ -
29 const QLocalServerPrivate * const d = d_func(); -
30 return d->socketOptions;
never executed: return d->socketOptions;
0
31} -
32 -
33 -
34 -
35 -
36 -
37 -
38 -
39void QLocalServer::close() -
40{ -
41 QLocalServerPrivate * const d = d_func(); -
42 if (!isListening())
evaluated: !isListening()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:46
7-46
43 return;
executed: return;
Execution Count:7
7
44 qDeleteAll(d->pendingConnections); -
45 d->pendingConnections.clear(); -
46 d->closeServer(); -
47 d->serverName.clear(); -
48 d->fullServerName.clear(); -
49 d->errorString.clear(); -
50 d->error = QAbstractSocket::UnknownSocketError; -
51}
executed: }
Execution Count:46
46
52QString QLocalServer::errorString() const -
53{ -
54 const QLocalServerPrivate * const d = d_func(); -
55 return d->errorString;
executed: return d->errorString;
Execution Count:42
42
56} -
57 -
58 -
59 -
60 -
61 -
62 -
63 -
64bool QLocalServer::hasPendingConnections() const -
65{ -
66 const QLocalServerPrivate * const d = d_func(); -
67 return !(d->pendingConnections.isEmpty());
executed: return !(d->pendingConnections.isEmpty());
Execution Count:83
83
68} -
69void QLocalServer::incomingConnection(quintptr socketDescriptor) -
70{ -
71 QLocalServerPrivate * const d = d_func(); -
72 QLocalSocket *socket = new QLocalSocket(this); -
73 socket->setSocketDescriptor(socketDescriptor); -
74 d->pendingConnections.enqueue(socket); -
75 newConnection(); -
76}
executed: }
Execution Count:71
71
77 -
78 -
79 -
80 -
81 -
82 -
83 -
84bool QLocalServer::isListening() const -
85{ -
86 const QLocalServerPrivate * const d = d_func(); -
87 return !(d->serverName.isEmpty());
executed: return !(d->serverName.isEmpty());
Execution Count:267
267
88} -
89bool QLocalServer::listen(const QString &name) -
90{ -
91 QLocalServerPrivate * const d = d_func(); -
92 if (isListening()) {
evaluated: isListening()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:52
2-52
93 QMessageLogger("socket/qlocalserver.cpp", 293, __PRETTY_FUNCTION__).warning("QLocalServer::listen() called when already listening"); -
94 return false;
executed: return false;
Execution Count:2
2
95 } -
96 -
97 if (name.isEmpty()) {
evaluated: name.isEmpty()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:44
8-44
98 d->error = QAbstractSocket::HostNotFoundError; -
99 QString function = QLatin1String("QLocalServer::listen"); -
100 d->errorString = tr("%1: Name error").arg(function); -
101 return false;
executed: return false;
Execution Count:8
8
102 } -
103 -
104 if (!d->listen(name)) {
evaluated: !d->listen(name)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:42
2-42
105 d->serverName.clear(); -
106 d->fullServerName.clear(); -
107 return false;
executed: return false;
Execution Count:2
2
108 } -
109 -
110 d->serverName = name; -
111 return true;
executed: return true;
Execution Count:42
42
112} -
113bool QLocalServer::listen(qintptr socketDescriptor) -
114{ -
115 QLocalServerPrivate * const d = d_func(); -
116 if (isListening()) {
partially evaluated: isListening()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
117 QMessageLogger("socket/qlocalserver.cpp", 334, __PRETTY_FUNCTION__).warning("QLocalServer::listen() called when already listening"); -
118 return false;
never executed: return false;
0
119 } -
120 -
121 d->serverName.clear(); -
122 d->fullServerName.clear(); -
123 -
124 if (!d->listen(socketDescriptor)) {
partially evaluated: !d->listen(socketDescriptor)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
125 return false;
never executed: return false;
0
126 } -
127 -
128 return true;
executed: return true;
Execution Count:4
4
129} -
130 -
131 -
132 -
133 -
134 -
135 -
136 -
137int QLocalServer::maxPendingConnections() const -
138{ -
139 const QLocalServerPrivate * const d = d_func(); -
140 return d->maxPendingConnections;
executed: return d->maxPendingConnections;
Execution Count:8
8
141} -
142QLocalSocket *QLocalServer::nextPendingConnection() -
143{ -
144 QLocalServerPrivate * const d = d_func(); -
145 if (d->pendingConnections.isEmpty())
evaluated: d->pendingConnections.isEmpty()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:67
10-67
146 return 0;
executed: return 0;
Execution Count:10
10
147 QLocalSocket *nextSocket = d->pendingConnections.dequeue(); -
148 -
149 if (d->pendingConnections.size() <= d->maxPendingConnections)
partially evaluated: d->pendingConnections.size() <= d->maxPendingConnections
TRUEFALSE
yes
Evaluation Count:67
no
Evaluation Count:0
0-67
150 -
151 d->socketNotifier->setEnabled(true);
executed: d->socketNotifier->setEnabled(true);
Execution Count:67
67
152 -
153 -
154 -
155 -
156 return nextSocket;
executed: return nextSocket;
Execution Count:67
67
157} -
158bool QLocalServer::removeServer(const QString &name) -
159{ -
160 return QLocalServerPrivate::removeServer(name);
executed: return QLocalServerPrivate::removeServer(name);
Execution Count:37
37
161} -
162 -
163 -
164 -
165 -
166 -
167 -
168 -
169QString QLocalServer::serverName() const -
170{ -
171 const QLocalServerPrivate * const d = d_func(); -
172 return d->serverName;
executed: return d->serverName;
Execution Count:19
19
173} -
174QString QLocalServer::fullServerName() const -
175{ -
176 const QLocalServerPrivate * const d = d_func(); -
177 return d->fullServerName;
executed: return d->fullServerName;
Execution Count:21
21
178} -
179 -
180 -
181 -
182 -
183 -
184 -
185QAbstractSocket::SocketError QLocalServer::serverError() const -
186{ -
187 const QLocalServerPrivate * const d = d_func(); -
188 return d->error;
executed: return d->error;
Execution Count:34
34
189} -
190void QLocalServer::setMaxPendingConnections(int numConnections) -
191{ -
192 QLocalServerPrivate * const d = d_func(); -
193 d->maxPendingConnections = numConnections; -
194}
executed: }
Execution Count:10
10
195bool QLocalServer::waitForNewConnection(int msec, bool *timedOut) -
196{ -
197 QLocalServerPrivate * const d = d_func(); -
198 if (timedOut)
evaluated: timedOut
TRUEFALSE
yes
Evaluation Count:65
yes
Evaluation Count:19
19-65
199 *timedOut = false;
executed: *timedOut = false;
Execution Count:65
65
200 -
201 if (!isListening())
evaluated: !isListening()
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:73
11-73
202 return false;
executed: return false;
Execution Count:11
11
203 -
204 d->waitForNewConnection(msec, timedOut); -
205 -
206 return !d->pendingConnections.isEmpty();
executed: return !d->pendingConnections.isEmpty();
Execution Count:73
73
207} -
208 -
209 -
210 -
211 -
212 -
213 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial