2 Copyright (C) 2012 Intel Corporation
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #include "abstractroutingengine.h"
24 AbstractRoutingEngine::~AbstractRoutingEngine()
28 AsyncPropertyReply::AsyncPropertyReply()
29 :AsyncPropertyRequest(), value(nullptr), success(false), timeoutSource(nullptr), timedout(nullptr)
34 AsyncPropertyReply::AsyncPropertyReply(const AsyncPropertyRequest &request)
35 :AsyncPropertyRequest(request), value(NULL), success(false), timeoutSource(nullptr), timedout(nullptr)
40 AsyncPropertyReply::AsyncPropertyReply(const AsyncSetPropertyRequest &request)
41 :AsyncPropertyRequest(request), value(request.value), success(false), timeoutSource(nullptr), timedout(nullptr)
45 value->zone = request.zoneFilter;
48 AsyncPropertyReply::~AsyncPropertyReply()
52 g_source_destroy(timeoutSource);
53 g_source_unref(timeoutSource);
57 void AsyncPropertyReply::setTimeout()
59 auto timeoutfunc = [](gpointer userData) {
60 AsyncPropertyReply* thisReply = static_cast<AsyncPropertyReply*>(userData);
61 if(thisReply->success == false)
63 thisReply->error = Timeout;
64 if(thisReply->timedout)
65 thisReply->timedout(thisReply);
66 if(thisReply->completed)
67 thisReply->completed(thisReply);
74 timeoutSource = g_timeout_source_new(timeout);
75 g_source_set_callback(timeoutSource,(GSourceFunc) timeoutfunc, this, nullptr);
76 g_source_attach(timeoutSource, nullptr);