Skip to content

Commit

Permalink
stream write debug print.
Browse files Browse the repository at this point in the history
  • Loading branch information
redboltz committed Nov 19, 2024
1 parent 9ef6de5 commit f940a39
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/async_mqtt/util/impl/stream_write_packet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define ASYNC_MQTT_IMPL_STREAM_WRITE_PACKET_HPP

#include <async_mqtt/util/stream.hpp>
#include <iostream>

namespace async_mqtt {

Expand All @@ -32,13 +33,15 @@ struct stream_impl<NextLayer>::stream_write_packet_op {
auto& a_strm{*strm};
switch (state) {
case dispatch: {
std::cout << __FILE__ << ":" << __LINE__ << ":" << *packet << std::endl;
state = post;
as::dispatch(
a_strm.get_executor(),
force_move(self)
);
} break;
case post: {
std::cout << __FILE__ << ":" << __LINE__ << ":" << *packet << std::endl;
auto& a_packet{*packet};
if (!a_strm.bulk_write_ || a_strm.write_queue_.immediate_executable()) {
state = write;
Expand All @@ -54,6 +57,7 @@ struct stream_impl<NextLayer>::stream_write_packet_op {
a_strm.write_queue_.try_execute();
} break;
case write: {
std::cout << __FILE__ << ":" << __LINE__ << ":" << *packet << std::endl;
a_strm.write_queue_.start_work();
if (a_strm.lowest_layer().is_open()) {
state = complete;
Expand Down Expand Up @@ -87,6 +91,7 @@ struct stream_impl<NextLayer>::stream_write_packet_op {
}
} break;
case bulk_write: {
std::cout << __FILE__ << ":" << __LINE__ << ":" << *packet << std::endl;
a_strm.write_queue_.start_work();
if (a_strm.lowest_layer().is_open()) {
state = complete;
Expand Down Expand Up @@ -146,6 +151,7 @@ struct stream_impl<NextLayer>::stream_write_packet_op {
) {
auto& a_strm{*strm};
if (ec) {
std::cout << __FILE__ << ":" << __LINE__ << ":" << *packet << std::endl;
a_strm.write_queue_.stop_work();
as::post(
a_strm.get_executor(),
Expand All @@ -158,6 +164,7 @@ struct stream_impl<NextLayer>::stream_write_packet_op {
}
switch (state) {
case complete: {
std::cout << __FILE__ << ":" << __LINE__ << ":" << *packet << std::endl;
a_strm.write_queue_.stop_work();
a_strm.sending_cbs_.clear();
as::post(
Expand Down

0 comments on commit f940a39

Please sign in to comment.