Skip to content

Commit 9ff3509

Browse files
committed
Add udp server id to debug logs
1 parent a4fa696 commit 9ff3509

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

src/resolve_attempt_udp.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ resolve_attempt_udp::resolve_attempt_udp(io_context &io, const udp &protocol,
5050
os << recv_socket_.local_endpoint().port() << " " << query_id_ << "\r\n";
5151
query_msg_ = os.str();
5252

53+
DLOG_F(2, "Waiting for query results (port %d) for %s", recv_socket_.local_endpoint().port(),
54+
query_msg_.c_str());
55+
5356
// register ourselves as a candidate for cancellation
5457
if (registry) register_at(registry);
5558
}

src/tcp_server.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ void client_session::handle_read_feedparams(
347347
int request_protocol_version, std::string request_uid, error_code err) {
348348
try {
349349
if (!err) {
350-
DLOG_F(3, "%p got a streamfeed request", this);
350+
DLOG_F(2, "%p got a streamfeed request", this);
351351
// --- protocol negotiation ---
352352

353353
// check request validity
@@ -356,7 +356,7 @@ void client_session::handle_read_feedparams(
356356
send_status_message(
357357
"LSL/" + std::to_string(api_config::get_instance()->use_protocol_version()) +
358358
" 505 Version not supported");
359-
DLOG_F(INFO, "%p Got a request for a too new protocol version", this);
359+
DLOG_F(WARNING, "%p Got a request for a too new protocol version", this);
360360
return;
361361
}
362362
if (!request_uid.empty() && request_uid != serv_->info_->uid()) {
@@ -408,7 +408,7 @@ void client_session::handle_read_feedparams(
408408
if (type == "max-chunk-length") chunk_granularity_ = std::stoi(rest);
409409
if (type == "protocol-version") client_protocol_version = std::stoi(rest);
410410
} else {
411-
DLOG_F(4, "%p Request line '%s' contained no key-value pair", this,
411+
DLOG_F(WARNING, "%p Request line '%s' contained no key-value pair", this,
412412
hdrline.c_str());
413413
}
414414
}
@@ -492,7 +492,7 @@ void client_session::handle_read_feedparams(
492492
*sock_, feedbuf_.data(), [shared_this = shared_from_this()](err_t err, size_t len) {
493493
shared_this->handle_send_feedheader_outcome(err, len);
494494
});
495-
DLOG_F(4, "%p sent test pattern samples", this);
495+
DLOG_F(2, "%p sent test pattern samples", this);
496496
}
497497
} catch (std::exception &e) {
498498
LOG_F(WARNING, "Unexpected error while serializing the feed header: %s", e.what());

src/udp_server.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ udp_server::udp_server(const stream_info_impl_p &info, io_context &io, udp proto
2525
info_->v4service_port(port);
2626
else
2727
info_->v6service_port(port);
28-
LOG_F(2, "%s: Started unicast udp server %p at port %d", info_->name().c_str(), this, port);
28+
LOG_F(2, "%s: Started unicast udp server at port %d (addr %p)", info_->name().c_str(), port,
29+
(void *)this);
2930
}
3031

3132
udp_server::udp_server(const stream_info_impl_p &info, io_context &io, const std::string &address,
@@ -67,8 +68,8 @@ udp_server::udp_server(const stream_info_impl_p &info, io_context &io, const std
6768
else
6869
socket_->set_option(ip::multicast::join_group(addr));
6970
}
70-
LOG_F(2, "%s: Started multicast udp server at %s port %d", this->info_->name().c_str(),
71-
address.c_str(), port);
71+
LOG_F(2, "%s: Started multicast udp server at %s port %d (addr %p)",
72+
this->info_->name().c_str(), address.c_str(), port, (void *)this);
7273
}
7374

7475
// === externally issued asynchronous commands ===
@@ -123,8 +124,12 @@ void udp_server::handle_receive_outcome(error_code err, std::size_t len) {
123124
request_stream >> return_port;
124125
std::string query_id;
125126
request_stream >> query_id;
127+
DLOG_F(2, "%p shortinfo req from %s for %s", (void *)this,
128+
remote_endpoint_.address().to_string().c_str(), query.c_str());
126129
// check query
127130
if (info_->matches_query(query)) {
131+
LOG_F(
132+
3, "%p query matches, replying to port %d", (void *)this, return_port);
128133
// query matches: send back reply
129134
udp::endpoint return_endpoint(remote_endpoint_.address(), return_port);
130135
string_p replymsg(
@@ -136,8 +141,7 @@ void udp_server::handle_receive_outcome(error_code err, std::size_t len) {
136141
});
137142
return;
138143
} else {
139-
DLOG_F(INFO, "%p Got shortinfo query for mismatching query string: %s", this,
140-
query.c_str());
144+
DLOG_F(2, "%p query didn't match", (void *)this);
141145
}
142146
} else if (time_services_enabled_ && method == "LSL:timedata") {
143147
// timedata request: parse time of original transmission
@@ -158,11 +162,13 @@ void udp_server::handle_receive_outcome(error_code err, std::size_t len) {
158162
});
159163
return;
160164
} else {
161-
DLOG_F(INFO, "Unknown method '%s' received by udp-server", method.c_str());
165+
DLOG_F(INFO, "%p Unknown method '%s' received by udp-server", (void *)this,
166+
method.c_str());
162167
}
163168
}
164169
} catch (std::exception &e) {
165-
LOG_F(WARNING, "udp_server: hiccup during request processing: %s", e.what());
170+
LOG_F(WARNING, "%p udp_server: hiccup during request processing: %s", (void *)this,
171+
e.what());
166172
}
167173
request_next_packet();
168174
}

0 commit comments

Comments
 (0)