made lsd build without exception support
This commit is contained in:
parent
2050b03727
commit
9e421b2945
19
src/lsd.cpp
19
src/lsd.cpp
|
@ -95,11 +95,11 @@ void lsd::announce(sha1_hash const& ih, int listen_port)
|
||||||
<< " ==> announce: ih: " << ih << " port: " << listen_port << std::endl;
|
<< " ==> announce: ih: " << ih << " port: " << listen_port << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_broadcast_timer.expires_from_now(milliseconds(250 * m_retry_count));
|
m_broadcast_timer.expires_from_now(milliseconds(250 * m_retry_count), ec);
|
||||||
m_broadcast_timer.async_wait(bind(&lsd::resend_announce, self(), _1, msg));
|
m_broadcast_timer.async_wait(bind(&lsd::resend_announce, self(), _1, msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void lsd::resend_announce(asio::error_code const& e, std::string msg) try
|
void lsd::resend_announce(asio::error_code const& e, std::string msg)
|
||||||
{
|
{
|
||||||
if (e) return;
|
if (e) return;
|
||||||
|
|
||||||
|
@ -110,11 +110,9 @@ void lsd::resend_announce(asio::error_code const& e, std::string msg) try
|
||||||
if (m_retry_count >= 5)
|
if (m_retry_count >= 5)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_broadcast_timer.expires_from_now(milliseconds(250 * m_retry_count));
|
m_broadcast_timer.expires_from_now(milliseconds(250 * m_retry_count), ec);
|
||||||
m_broadcast_timer.async_wait(bind(&lsd::resend_announce, self(), _1, msg));
|
m_broadcast_timer.async_wait(bind(&lsd::resend_announce, self(), _1, msg));
|
||||||
}
|
}
|
||||||
catch (std::exception&)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void lsd::on_announce(udp::endpoint const& from, char* buffer
|
void lsd::on_announce(udp::endpoint const& from, char* buffer
|
||||||
, std::size_t bytes_transferred)
|
, std::size_t bytes_transferred)
|
||||||
|
@ -178,15 +176,22 @@ void lsd::on_announce(udp::endpoint const& from, char* buffer
|
||||||
<< ":" << port << " ih: " << ih << std::endl;
|
<< ":" << port << " ih: " << ih << std::endl;
|
||||||
#endif
|
#endif
|
||||||
// we got an announce, pass it on through the callback
|
// we got an announce, pass it on through the callback
|
||||||
try { m_callback(tcp::endpoint(from.address(), port), ih); }
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
|
try {
|
||||||
|
#endif
|
||||||
|
m_callback(tcp::endpoint(from.address(), port), ih);
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
|
}
|
||||||
catch (std::exception&) {}
|
catch (std::exception&) {}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lsd::close()
|
void lsd::close()
|
||||||
{
|
{
|
||||||
m_socket.close();
|
m_socket.close();
|
||||||
m_broadcast_timer.cancel();
|
asio::error_code ec;
|
||||||
|
m_broadcast_timer.cancel(ec);
|
||||||
m_disabled = true;
|
m_disabled = true;
|
||||||
m_callback.clear();
|
m_callback.clear();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue