merged string encoding of error messages fix from RC_0_16
This commit is contained in:
parent
3ddf55a686
commit
8f682d2ff7
|
@ -11,6 +11,7 @@
|
|||
|
||||
0.16.7 release
|
||||
|
||||
* fix string encoding in error messages
|
||||
* handle error in read_piece and set_piece_deadline when torrent is removed
|
||||
* DHT performance improvement
|
||||
* attempt to handle ERROR_CANT_WAIT disk error on windows
|
||||
|
|
|
@ -104,7 +104,7 @@ namespace libtorrent {
|
|||
{
|
||||
char ret[200 + TORRENT_MAX_PATH * 2];
|
||||
snprintf(ret, sizeof(ret), "%s: failed to rename file %d: %s"
|
||||
, torrent_alert::message().c_str(), index, error.message().c_str());
|
||||
, torrent_alert::message().c_str(), index, convert_from_native(error.message()).c_str());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ namespace libtorrent {
|
|||
{
|
||||
char ret[200];
|
||||
snprintf(ret, sizeof(ret), "listening on %s failed: %s"
|
||||
, print_endpoint(endpoint).c_str(), error.message().c_str());
|
||||
, print_endpoint(endpoint).c_str(), convert_from_native(error.message()).c_str());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ namespace libtorrent {
|
|||
{
|
||||
static char const* type_str[] = {"NAT-PMP", "UPnP"};
|
||||
return std::string("could not map port using ") + type_str[map_type]
|
||||
+ ": " + error.message();
|
||||
+ ": " + convert_from_native(error.message());
|
||||
}
|
||||
|
||||
std::string portmap_alert::message() const
|
||||
|
@ -562,14 +562,14 @@ namespace libtorrent {
|
|||
char msg[600];
|
||||
char const* state_msg[] = {"updating", "updated", "error"};
|
||||
snprintf(msg, sizeof(msg), "RSS feed %s: %s (%s)"
|
||||
, url.c_str(), state_msg[state], error.message().c_str());
|
||||
, url.c_str(), state_msg[state], convert_from_native(error.message()).c_str());
|
||||
return msg;
|
||||
}
|
||||
|
||||
std::string torrent_error_alert::message() const
|
||||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), " ERROR: %s", error.message().c_str());
|
||||
snprintf(msg, sizeof(msg), " ERROR: %s", convert_from_native(error.message()).c_str());
|
||||
return torrent_alert::message() + msg;
|
||||
}
|
||||
|
||||
|
@ -614,7 +614,8 @@ namespace libtorrent {
|
|||
char msg[600];
|
||||
if (error)
|
||||
{
|
||||
snprintf(msg, sizeof(msg), "failed to add torrent: %s", error.message().c_str());
|
||||
snprintf(msg, sizeof(msg), "failed to add torrent: %s"
|
||||
, convert_from_native(error.message()).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -303,7 +303,7 @@ namespace libtorrent
|
|||
{
|
||||
if (!m_msg)
|
||||
{
|
||||
std::string msg = m_error.message();
|
||||
std::string msg = convert_from_native(m_error.message());
|
||||
m_msg = allocate_string_copy(msg.c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,8 @@ void natpmp::rebind(address const& listen_interface)
|
|||
if (ec)
|
||||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "failed to find default route: %s", ec.message().c_str());
|
||||
snprintf(msg, sizeof(msg), "failed to find default route: %s"
|
||||
, convert_from_native(ec.message()).c_str());
|
||||
log(msg, l);
|
||||
disable(ec, l);
|
||||
return;
|
||||
|
@ -421,7 +422,8 @@ void natpmp::on_reply(error_code const& e
|
|||
if (e)
|
||||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "error on receiving reply: %s", e.message().c_str());
|
||||
snprintf(msg, sizeof(msg), "error on receiving reply: %s"
|
||||
, convert_from_native(e.message()).c_str());
|
||||
log(msg, l);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -8502,7 +8502,7 @@ namespace libtorrent
|
|||
#endif
|
||||
|
||||
st->has_incoming = m_has_incoming;
|
||||
if (m_error) st->error = m_error.message() + ": " + m_error_file;
|
||||
if (m_error) st->error = convert_from_native(m_error.message()) + ": " + m_error_file;
|
||||
st->seed_mode = m_seed_mode;
|
||||
|
||||
st->added_time = m_added_time;
|
||||
|
|
29
src/upnp.cpp
29
src/upnp.cpp
|
@ -148,7 +148,8 @@ void upnp::discover_device_impl(mutex::scoped_lock& l)
|
|||
if (ec)
|
||||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "broadcast failed: %s. Aborting.", ec.message().c_str());
|
||||
snprintf(msg, sizeof(msg), "broadcast failed: %s. Aborting."
|
||||
, convert_from_native(ec.message()).c_str());
|
||||
log(msg, l);
|
||||
disable(ec, l);
|
||||
return;
|
||||
|
@ -355,7 +356,7 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
|
|||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "when receiving response from: %s: %s"
|
||||
, print_endpoint(from).c_str(), ec.message().c_str());
|
||||
, print_endpoint(from).c_str(), convert_from_native(ec.message()).c_str());
|
||||
log(msg, l);
|
||||
}
|
||||
else
|
||||
|
@ -389,7 +390,7 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
|
|||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "when receiving response from: %s: %s"
|
||||
, print_endpoint(from).c_str(), ec.message().c_str());
|
||||
, print_endpoint(from).c_str(), convert_from_native(ec.message()).c_str());
|
||||
log(msg, l);
|
||||
}
|
||||
else
|
||||
|
@ -479,7 +480,7 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
|
|||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "invalid URL %s from %s: %s"
|
||||
, d.url.c_str(), print_endpoint(from).c_str(), ec.message().c_str());
|
||||
, d.url.c_str(), print_endpoint(from).c_str(), convert_from_native(ec.message()).c_str());
|
||||
log(msg, l);
|
||||
return;
|
||||
}
|
||||
|
@ -856,7 +857,7 @@ void upnp::on_upnp_xml(error_code const& e
|
|||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "error while fetching control url from: %s: %s"
|
||||
, d.url.c_str(), e.message().c_str());
|
||||
, d.url.c_str(), convert_from_native(e.message()).c_str());
|
||||
log(msg, l);
|
||||
d.disabled = true;
|
||||
return;
|
||||
|
@ -876,7 +877,7 @@ void upnp::on_upnp_xml(error_code const& e
|
|||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "error while fetching control url from: %s: %s"
|
||||
, d.url.c_str(), p.message().c_str());
|
||||
, d.url.c_str(), convert_from_native(p.message()).c_str());
|
||||
log(msg, l);
|
||||
d.disabled = true;
|
||||
return;
|
||||
|
@ -950,7 +951,7 @@ void upnp::on_upnp_xml(error_code const& e
|
|||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "failed to parse URL '%s': %s"
|
||||
, d.control_url.c_str(), ec.message().c_str());
|
||||
, d.control_url.c_str(), convert_from_native(ec.message()).c_str());
|
||||
log(msg, l);
|
||||
d.disabled = true;
|
||||
return;
|
||||
|
@ -1148,7 +1149,8 @@ void upnp::on_upnp_get_ip_address_response(error_code const& e
|
|||
if (e && e != asio::error::eof)
|
||||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "error while getting external IP address: %s", e.message().c_str());
|
||||
snprintf(msg, sizeof(msg), "error while getting external IP address: %s"
|
||||
, convert_from_native(e.message()).c_str());
|
||||
log(msg, l);
|
||||
if (num_mappings() > 0) update_map(d, 0, l);
|
||||
return;
|
||||
|
@ -1164,7 +1166,8 @@ void upnp::on_upnp_get_ip_address_response(error_code const& e
|
|||
if (p.status_code() != 200)
|
||||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "error while getting external IP address: %s", p.message().c_str());
|
||||
snprintf(msg, sizeof(msg), "error while getting external IP address: %s"
|
||||
, convert_from_native(p.message()).c_str());
|
||||
log(msg, l);
|
||||
if (num_mappings() > 0) update_map(d, 0, l);
|
||||
return;
|
||||
|
@ -1225,7 +1228,7 @@ void upnp::on_upnp_map_response(error_code const& e
|
|||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "error while adding port map: %s"
|
||||
, e.message().c_str());
|
||||
, convert_from_native(e.message()).c_str());
|
||||
log(msg, l);
|
||||
d.disabled = true;
|
||||
return;
|
||||
|
@ -1386,7 +1389,8 @@ void upnp::on_upnp_unmap_response(error_code const& e
|
|||
if (e && e != asio::error::eof)
|
||||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "error while deleting portmap: %s", e.message().c_str());
|
||||
snprintf(msg, sizeof(msg), "error while deleting portmap: %s"
|
||||
, convert_from_native(e.message()).c_str());
|
||||
log(msg, l);
|
||||
}
|
||||
else if (!p.header_finished())
|
||||
|
@ -1396,7 +1400,8 @@ void upnp::on_upnp_unmap_response(error_code const& e
|
|||
else if (p.status_code() != 200)
|
||||
{
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "error while deleting portmap: %s", p.message().c_str());
|
||||
snprintf(msg, sizeof(msg), "error while deleting portmap: %s"
|
||||
, convert_from_native(p.message()).c_str());
|
||||
log(msg, l);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue