changed logging

This commit is contained in:
badaix 2015-08-23 23:24:36 +02:00
parent dbf44b0220
commit 48ac9d2209
3 changed files with 15 additions and 11 deletions

View file

@ -88,16 +88,15 @@ void BrowseAvahi::resolve_callback(
browseAvahi->result_.valid_ = true;
t = avahi_string_list_to_string(txt);
logO
<< "\t" << host_name << ":" << port << "(" << a << ")\n"
<< "\tTXT=" << t << "\n"
<< "\tProto=" << (int)protocol << "\n"
<< "\tcookie is " << avahi_string_list_get_service_cookie(txt) << "\n"
<< "\tis_local: " << !!(flags & AVAHI_LOOKUP_RESULT_LOCAL) << "\n"
<< "\tour_own: " << !!(flags & AVAHI_LOOKUP_RESULT_OUR_OWN) << "\n"
<< "\twide_area: " << !!(flags & AVAHI_LOOKUP_RESULT_WIDE_AREA) << "\n"
<< "\tmulticast: " << !!(flags & AVAHI_LOOKUP_RESULT_MULTICAST) << "\n"
<< "\tcached: " << !!(flags & AVAHI_LOOKUP_RESULT_CACHED) << "\n";
logO << "\t" << host_name << ":" << port << "(" << a << ")\n";
logD << "\tTXT=" << t << "\n";
logD << "\tProto=" << (int)protocol << "\n";
logD << "\tcookie is " << avahi_string_list_get_service_cookie(txt) << "\n";
logD << "\tis_local: " << !!(flags & AVAHI_LOOKUP_RESULT_LOCAL) << "\n";
logD << "\tour_own: " << !!(flags & AVAHI_LOOKUP_RESULT_OUR_OWN) << "\n";
logD << "\twide_area: " << !!(flags & AVAHI_LOOKUP_RESULT_WIDE_AREA) << "\n";
logD << "\tmulticast: " << !!(flags & AVAHI_LOOKUP_RESULT_MULTICAST) << "\n";
logD << "\tcached: " << !!(flags & AVAHI_LOOKUP_RESULT_CACHED) << "\n";
avahi_free(t);
}
}

View file

@ -80,6 +80,11 @@ public:
return buffer.size();
}
inline bool empty() const
{
return (buffer.size() == 0);
}
void setSize(size_t size)
{
bufferSize = size;

View file

@ -30,7 +30,7 @@ void TimeProvider::setDiffToServer(double ms)
{
long now = chronos::getTickCount();
/// clear diffBuffer if last update is older than a minute
if (now > lastTimeSync_ + 60*1000)
if (!diffBuffer_.empty() && (now > lastTimeSync_ + 60*1000))
{
logO << "Last time sync older than a minute. Clearing time buffer\n";
diffToServer_ = ms*1000;