Changeset View
Changeset View
Standalone View
Standalone View
src/publictransport/manager.cpp
Show First 20 Lines • Show All 168 Lines • ▼ Show 20 Line(s) | |||||
169 | } | 169 | } | ||
170 | 170 | | |||
171 | JourneyReply* Manager::queryJourney(const JourneyRequest &req) const | 171 | JourneyReply* Manager::queryJourney(const JourneyRequest &req) const | ||
172 | { | 172 | { | ||
173 | auto reply = new JourneyReply(req); | 173 | auto reply = new JourneyReply(req); | ||
174 | int pendingOps = 0; | 174 | int pendingOps = 0; | ||
175 | for (const auto &backend : d->m_backends) { | 175 | for (const auto &backend : d->m_backends) { | ||
176 | if (backend->isLocationExcluded(req.from()) && backend->isLocationExcluded(req.to())) { | 176 | if (backend->isLocationExcluded(req.from()) && backend->isLocationExcluded(req.to())) { | ||
177 | qCDebug(Log) << "Skiping backend based on location filter:" << backend->backendId(); | 177 | qCDebug(Log) << "Skipping backend based on location filter:" << backend->backendId(); | ||
178 | continue; | 178 | continue; | ||
179 | } | 179 | } | ||
180 | if (!backend->isSecure() && !d->m_allowInsecure) { | 180 | if (!backend->isSecure() && !d->m_allowInsecure) { | ||
181 | qCDebug(Log) << "Skipping insecure backend:" << backend->backendId(); | 181 | qCDebug(Log) << "Skipping insecure backend:" << backend->backendId(); | ||
182 | continue; | 182 | continue; | ||
183 | } | 183 | } | ||
184 | if (backend->queryJourney(reply, d->nam())) { | 184 | if (backend->queryJourney(reply, d->nam())) { | ||
185 | ++pendingOps; | 185 | ++pendingOps; | ||
186 | } | 186 | } | ||
187 | } | 187 | } | ||
188 | reply->setPendingOps(pendingOps); | 188 | reply->setPendingOps(pendingOps); | ||
189 | return reply; | 189 | return reply; | ||
190 | } | 190 | } | ||
191 | 191 | | |||
192 | DepartureReply* Manager::queryDeparture(const DepartureRequest &req) const | 192 | DepartureReply* Manager::queryDeparture(const DepartureRequest &req) const | ||
193 | { | 193 | { | ||
194 | auto reply = new DepartureReply(req); | 194 | auto reply = new DepartureReply(req); | ||
195 | int pendingOps = 0; | 195 | int pendingOps = 0; | ||
196 | for (const auto &backend : d->m_backends) { | 196 | for (const auto &backend : d->m_backends) { | ||
197 | if (backend->isLocationExcluded(req.stop())) { | 197 | if (backend->isLocationExcluded(req.stop())) { | ||
198 | qCDebug(Log) << "Skiping backend based on location filter:" << backend->backendId(); | 198 | qCDebug(Log) << "Skipping backend based on location filter:" << backend->backendId(); | ||
199 | continue; | 199 | continue; | ||
200 | } | 200 | } | ||
201 | if (!backend->isSecure() && !d->m_allowInsecure) { | 201 | if (!backend->isSecure() && !d->m_allowInsecure) { | ||
202 | qCDebug(Log) << "Skipping insecure backend:" << backend->backendId(); | 202 | qCDebug(Log) << "Skipping insecure backend:" << backend->backendId(); | ||
203 | continue; | 203 | continue; | ||
204 | } | 204 | } | ||
205 | if (backend->queryDeparture(reply, d->nam())) { | 205 | if (backend->queryDeparture(reply, d->nam())) { | ||
206 | ++pendingOps; | 206 | ++pendingOps; | ||
207 | } | 207 | } | ||
208 | } | 208 | } | ||
209 | reply->setPendingOps(pendingOps); | 209 | reply->setPendingOps(pendingOps); | ||
210 | return reply; | 210 | return reply; | ||
211 | } | 211 | } | ||
212 | 212 | | |||
213 | LocationReply* Manager::queryLocation(const LocationRequest &req) const | 213 | LocationReply* Manager::queryLocation(const LocationRequest &req) const | ||
214 | { | 214 | { | ||
215 | auto reply = new LocationReply(req); | 215 | auto reply = new LocationReply(req); | ||
216 | int pendingOps = 0; | 216 | int pendingOps = 0; | ||
217 | for (const auto &backend : d->m_backends) { | 217 | for (const auto &backend : d->m_backends) { | ||
218 | if (req.hasCoordinate() && backend->isCoordinateExcluded(req.latitude(), req.longitude())) { | 218 | if (req.hasCoordinate() && backend->isCoordinateExcluded(req.latitude(), req.longitude())) { | ||
219 | qCDebug(Log) << "Skiping backend based on location filter:" << backend->backendId(); | 219 | qCDebug(Log) << "Skipping backend based on location filter:" << backend->backendId(); | ||
220 | continue; | 220 | continue; | ||
221 | } | 221 | } | ||
222 | if (!backend->isSecure() && !d->m_allowInsecure) { | 222 | if (!backend->isSecure() && !d->m_allowInsecure) { | ||
223 | qCDebug(Log) << "Skipping insecure backend:" << backend->backendId(); | 223 | qCDebug(Log) << "Skipping insecure backend:" << backend->backendId(); | ||
224 | continue; | 224 | continue; | ||
225 | } | 225 | } | ||
226 | 226 | | |||
227 | auto cache = Cache::lookupLocation(backend->backendId(), req.cacheKey()); | 227 | auto cache = Cache::lookupLocation(backend->backendId(), req.cacheKey()); | ||
Show All 19 Lines |