improve portmap logging

This commit is contained in:
arvidn 2020-03-17 10:53:47 +01:00 committed by Arvid Norberg
parent 61a923e9b8
commit 95fe4ba3e2
2 changed files with 4 additions and 2 deletions

View File

@ -1146,7 +1146,7 @@ namespace {
std::string portmap_log_alert::message() const std::string portmap_log_alert::message() const
{ {
char ret[600]; char ret[1024];
std::snprintf(ret, sizeof(ret), "%s: %s" std::snprintf(ret, sizeof(ret), "%s: %s"
, nat_type_str[static_cast<int>(map_transport)] , nat_type_str[static_cast<int>(map_transport)]
, log_message()); , log_message());

View File

@ -285,7 +285,9 @@ void natpmp::mapping_log(char const* op, mapping_t const& m) const
, m.external_port , m.external_port
, m.local_port , m.local_port
, to_string(m.act) , to_string(m.act)
, total_seconds(m.expires - aux::time_now())); , (m.expires.time_since_epoch() != seconds(0))
? total_seconds(m.expires - aux::time_now())
: std::int64_t(0));
} }
} }