Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/map
diff options
context:
space:
mode:
authorSergey Yershov <yershov@corp.mail.ru>2016-06-22 15:46:46 +0300
committerVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2016-06-24 16:02:07 +0300
commit098ca2f3a91d14cb7a0f2f016f88829e32e8d3ab (patch)
tree8b3596b1e4843f0828ef7c9b3dee0d57ad85d420 /map
parent8d87825476f1505c59ed6f83195d1d94d5b5f616 (diff)
[booking] Destroy booking api connection
Diffstat (limited to 'map')
-rw-r--r--map/booking_api.cpp7
-rw-r--r--map/booking_api.hpp5
2 files changed, 7 insertions, 5 deletions
diff --git a/map/booking_api.cpp b/map/booking_api.cpp
index ec1568ab60..d852fc860c 100644
--- a/map/booking_api.cpp
+++ b/map/booking_api.cpp
@@ -1,7 +1,5 @@
#include "map/booking_api.hpp"
-#include "platform/http_request.hpp"
-
#include "base/gmtime.hpp"
#include "base/logging.hpp"
@@ -47,7 +45,7 @@ void BookingApi::GetMinPrice(string const & hotelId, string const & currency,
{"currency_code", currency},
{"arrival_date", dateArrival},
{"departure_date", dateDeparture}});
- auto const callback = [fn, currency](downloader::HttpRequest & answer)
+ auto const callback = [this, fn, currency](downloader::HttpRequest & answer)
{
string minPrice;
@@ -96,9 +94,10 @@ void BookingApi::GetMinPrice(string const & hotelId, string const & currency,
priceCurrency.clear();
}
fn(minPrice, priceCurrency);
+ m_request.reset();
};
- downloader::HttpRequest::Get(url, callback);
+ m_request.reset(downloader::HttpRequest::Get(url, callback));
}
string BookingApi::MakeApiUrl(string const & func,
diff --git a/map/booking_api.hpp b/map/booking_api.hpp
index 1cd45a012c..76fef16c7c 100644
--- a/map/booking_api.hpp
+++ b/map/booking_api.hpp
@@ -1,9 +1,11 @@
#pragma once
+#include "platform/http_request.hpp"
+
#include "std/function.hpp"
#include "std/initializer_list.hpp"
-#include "std/map.hpp"
#include "std/string.hpp"
+#include "std/unique_ptr.hpp"
#include "std/utility.hpp"
class BookingApi
@@ -21,5 +23,6 @@ public:
function<void(string const &, string const &)> const & fn);
protected:
+ unique_ptr<downloader::HttpRequest> m_request;
string MakeApiUrl(string const & func, initializer_list<pair<string, string>> const & params);
};