qlocalserver.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/socket/qlocalserver.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3QLocalServer::QLocalServer(QObject *parent)-
4 : QObject(*new QLocalServerPrivate, parent)-
5{-
6 QLocalServerPrivate * const d = d_func();-
7 d->init();-
8}
executed 57 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
57
9QLocalServer::~QLocalServer()-
10{-
11 if (isListening()
isListening()Description
TRUEevaluated 40 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
FALSEevaluated 17 times by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
)
17-40
12 close();
executed 40 times by 3 tests: close();
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
40
13}
executed 57 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
57
14void QLocalServer::setSocketOptions(SocketOptions options)-
15{-
16 QLocalServerPrivate * const d = d_func();-
17-
18 d->socketOptions = options;-
19}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qlocalsocket - unknown status
4
20-
21-
22-
23-
24-
25-
26-
27QLocalServer::SocketOptions QLocalServer::socketOptions() const-
28{-
29 const QLocalServerPrivate * const d = d_func();-
30 return
never executed: return d->socketOptions;
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()
!isListening()Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
FALSEevaluated 50 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
)
5-50
43 return;
executed 5 times by 1 test: return;
Executed by:
  • tst_qlocalsocket - unknown status
5
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 50 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
50
52QString QLocalServer::errorString() const-
53{-
54 const QLocalServerPrivate * const d = d_func();-
55 return
executed 42 times by 2 tests: return d->errorString;
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
d->errorString;
executed 42 times by 2 tests: return d->errorString;
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
42
56}-
57-
58-
59-
60-
61-
62-
63-
64bool QLocalServer::hasPendingConnections() const-
65{-
66 const QLocalServerPrivate * const d = d_func();-
67 return
executed 79 times by 2 tests: return !(d->pendingConnections.isEmpty());
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
!(d->pendingConnections.isEmpty());
executed 79 times by 2 tests: return !(d->pendingConnections.isEmpty());
Executed by:
  • tst_QNetworkReply
  • tst_qlocalsocket - unknown status
79
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 77 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
77
77-
78-
79-
80-
81-
82-
83-
84bool QLocalServer::isListening() const-
85{-
86 const QLocalServerPrivate * const d = d_func();-
87 return
executed 277 times by 3 tests: return !(d->serverName.isEmpty());
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
!(d->serverName.isEmpty());
executed 277 times by 3 tests: return !(d->serverName.isEmpty());
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
277
88}-
89bool QLocalServer::listen(const QString &name)-
90{-
91 QLocalServerPrivate * const d = d_func();-
92 if (isListening()
isListening()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
FALSEevaluated 54 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
) {
2-54
93 QMessageLogger(__FILE__, 290, __PRETTY_FUNCTION__).warning("QLocalServer::listen() called when already listening");-
94 return
executed 2 times by 1 test: return false;
Executed by:
  • tst_qlocalsocket - unknown status
false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_qlocalsocket - unknown status
2
95 }-
96-
97 if (name.isEmpty()
name.isEmpty()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
FALSEevaluated 48 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
) {
6-48
98 d->error = QAbstractSocket::HostNotFoundError;-
99 QString function = QLatin1String("QLocalServer::listen");-
100 d->errorString = tr("%1: Name error").arg(function);-
101 return
executed 6 times by 1 test: return false;
Executed by:
  • tst_qlocalsocket - unknown status
false;
executed 6 times by 1 test: return false;
Executed by:
  • tst_qlocalsocket - unknown status
6
102 }-
103-
104 if (!d->listen(name)
!d->listen(name)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
FALSEevaluated 46 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
) {
2-46
105 d->serverName.clear();-
106 d->fullServerName.clear();-
107 return
executed 2 times by 1 test: return false;
Executed by:
  • tst_qlocalsocket - unknown status
false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_qlocalsocket - unknown status
2
108 }-
109-
110 d->serverName = name;-
111 return
executed 46 times by 3 tests: return true;
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
true;
executed 46 times by 3 tests: return true;
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
46
112}-
113bool QLocalServer::listen(qintptr socketDescriptor)-
114{-
115 QLocalServerPrivate * const d = d_func();-
116 if (isListening()
isListening()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
) {
0-4
117 QMessageLogger(__FILE__, 331, __PRETTY_FUNCTION__).warning("QLocalServer::listen() called when already listening");-
118 return
never executed: return false;
false;
never executed: return false;
0
119 }-
120-
121 d->serverName.clear();-
122 d->fullServerName.clear();-
123-
124 if (!d->listen(socketDescriptor)
!d->listen(socketDescriptor)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
) {
0-4
125 return
never executed: return false;
false;
never executed: return false;
0
126 }-
127-
128 return
executed 4 times by 1 test: return true;
Executed by:
  • tst_qlocalsocket - unknown status
true;
executed 4 times by 1 test: return true;
Executed by:
  • tst_qlocalsocket - unknown status
4
129}-
130-
131-
132-
133-
134-
135-
136-
137int QLocalServer::maxPendingConnections() const-
138{-
139 const QLocalServerPrivate * const d = d_func();-
140 return
executed 8 times by 1 test: return d->maxPendingConnections;
Executed by:
  • tst_qlocalsocket - unknown status
d->maxPendingConnections;
executed 8 times by 1 test: return d->maxPendingConnections;
Executed by:
  • tst_qlocalsocket - unknown status
8
141}-
142QLocalSocket *QLocalServer::nextPendingConnection()-
143{-
144 QLocalServerPrivate * const d = d_func();-
145 if (d->pendingConnections.isEmpty()
d->pendingConn...ions.isEmpty()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
FALSEevaluated 71 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
)
10-71
146 return
executed 10 times by 1 test: return 0;
Executed by:
  • tst_qlocalsocket - unknown status
0;
executed 10 times by 1 test: return 0;
Executed by:
  • tst_qlocalsocket - unknown status
10
147 QLocalSocket *nextSocket = d->pendingConnections.dequeue();-
148-
149 if (d->pendingConnections.size() <= d->maxPendingConnections
d->pendingConn...ingConnectionsDescription
TRUEevaluated 71 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
FALSEnever evaluated
)
0-71
150-
151 d->socketNotifier->setEnabled(true);
executed 71 times by 3 tests: d->socketNotifier->setEnabled(true);
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
71
152-
153-
154-
155-
156 return
executed 71 times by 3 tests: return nextSocket;
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
nextSocket;
executed 71 times by 3 tests: return nextSocket;
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
71
157}-
158bool QLocalServer::removeServer(const QString &name)-
159{-
160 return
executed 35 times by 2 tests: return QLocalServerPrivate::removeServer(name);
Executed by:
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
QLocalServerPrivate::removeServer(name);
executed 35 times by 2 tests: return QLocalServerPrivate::removeServer(name);
Executed by:
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
35
161}-
162-
163-
164-
165-
166-
167-
168-
169QString QLocalServer::serverName() const-
170{-
171 const QLocalServerPrivate * const d = d_func();-
172 return
executed 21 times by 1 test: return d->serverName;
Executed by:
  • tst_qlocalsocket - unknown status
d->serverName;
executed 21 times by 1 test: return d->serverName;
Executed by:
  • tst_qlocalsocket - unknown status
21
173}-
174QString QLocalServer::fullServerName() const-
175{-
176 const QLocalServerPrivate * const d = d_func();-
177 return
executed 21 times by 1 test: return d->fullServerName;
Executed by:
  • tst_qlocalsocket - unknown status
d->fullServerName;
executed 21 times by 1 test: return d->fullServerName;
Executed by:
  • tst_qlocalsocket - unknown status
21
178}-
179-
180-
181-
182-
183-
184-
185QAbstractSocket::SocketError QLocalServer::serverError() const-
186{-
187 const QLocalServerPrivate * const d = d_func();-
188 return
executed 40 times by 1 test: return d->error;
Executed by:
  • tst_qlocalsocket - unknown status
d->error;
executed 40 times by 1 test: return d->error;
Executed by:
  • tst_qlocalsocket - unknown status
40
189}-
190void QLocalServer::setMaxPendingConnections(int numConnections)-
191{-
192 QLocalServerPrivate * const d = d_func();-
193 d->maxPendingConnections = numConnections;-
194}
executed 10 times by 1 test: end of block
Executed by:
  • tst_qlocalsocket - unknown status
10
195bool QLocalServer::waitForNewConnection(int msec, bool *timedOut)-
196{-
197 QLocalServerPrivate * const d = d_func();-
198 if (timedOut
timedOutDescription
TRUEevaluated 63 times by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
FALSEevaluated 25 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
)
25-63
199 *
executed 63 times by 1 test: *timedOut = false;
Executed by:
  • tst_qlocalsocket - unknown status
timedOut = false;
executed 63 times by 1 test: *timedOut = false;
Executed by:
  • tst_qlocalsocket - unknown status
63
200-
201 if (!isListening()
!isListening()Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_qlocalsocket - unknown status
FALSEevaluated 79 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
)
9-79
202 return
executed 9 times by 1 test: return false;
Executed by:
  • tst_qlocalsocket - unknown status
false;
executed 9 times by 1 test: return false;
Executed by:
  • tst_qlocalsocket - unknown status
9
203-
204 d->waitForNewConnection(msec, timedOut);-
205-
206 return
executed 79 times by 3 tests: return !d->pendingConnections.isEmpty();
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
!d->pendingConnections.isEmpty();
executed 79 times by 3 tests: return !d->pendingConnections.isEmpty();
Executed by:
  • tst_QNetworkReply
  • tst_QNetworkSession
  • tst_qlocalsocket - unknown status
79
207}-
208-
209-
210-
211-
212-
Switch to Source codePreprocessed file

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