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
diff options
context:
space:
mode:
authorSergey Yershov <syershov@maps.me>2016-10-28 13:00:29 +0300
committerSergey Yershov <syershov@maps.me>2016-10-28 13:00:29 +0300
commit971b3d39f69bd33f9d9010e2afb878933928c83e (patch)
tree8e7565c93f0d9dbe9a834e2ec8f8a9839bd09aa1 /tracking/connection.cpp
parent9f0137188b8179f41175624d8191a5af0502155e (diff)
Fix tracking and tests
Diffstat (limited to 'tracking/connection.cpp')
-rw-r--r--tracking/connection.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tracking/connection.cpp b/tracking/connection.cpp
index 26cbfadba3..c25e3de66e 100644
--- a/tracking/connection.cpp
+++ b/tracking/connection.cpp
@@ -16,7 +16,8 @@ Connection::Connection(unique_ptr<platform::Socket> socket, string const & host,
bool isHistorical)
: m_socket(move(socket)), m_host(host), m_port(port), m_isHistorical(isHistorical)
{
- ASSERT(m_socket.get(), ());
+ if (!m_socket)
+ return;
m_socket->SetTimeout(kSocketTimeoutMs);
}
@@ -24,6 +25,9 @@ Connection::Connection(unique_ptr<platform::Socket> socket, string const & host,
// TODO: implement handshake
bool Connection::Reconnect()
{
+ if (!m_socket)
+ return false;
+
m_socket->Close();
if (!m_socket->Open(m_host, m_port))
@@ -45,6 +49,9 @@ bool Connection::Reconnect()
// TODO: implement historical
bool Connection::Send(boost::circular_buffer<DataPoint> const & points)
{
+ if (!m_socket)
+ return false;
+
auto packet = Protocol::CreateDataPacket(points);
return m_socket->Write(packet.data(), static_cast<uint32_t>(packet.size()));
}