@@ -30,15 +30,17 @@ void HopperEndpoint::on_pipe_readable(uint64_t id) {
3030 if (res == (size_t )-1 )
3131 throw_errno (" read" );
3232
33- std::cout << pipe-> name () << " ( " << m_name << " ) -> " << res << " bytes\n " ;
33+ std::cout << * pipe << " -> " << res << " bytes\n " ;
3434}
3535
3636void HopperEndpoint::flush_pipes () {
3737 for (const auto &[_, pipe] : m_outputs) {
3838 if (pipe->status () == PipeStatus::INACTIVE)
3939 continue ;
4040
41- m_buffer.read (pipe);
41+ size_t res = m_buffer.read (pipe);
42+ if (res > 0 )
43+ std::cout << *pipe << " <- " << res << " bytes\n " ;
4244 }
4345}
4446
@@ -61,11 +63,11 @@ HopperPipe *HopperEndpoint::add_input_pipe(const std::filesystem::path &path) {
6163 if (id == 0 ) // ID 0 is never valid
6264 return nullptr ;
6365
64- std::cout << " OPEN IN " << path << " \n " ;
65-
66- HopperPipe *p = new HopperPipe (id, PipeType::IN, path, nullptr );
66+ HopperPipe *p = new HopperPipe (id, m_name, PipeType::IN, path, nullptr );
6767 m_inputs[id] = p;
6868
69+ std::cout << " OPEN " << *p << " \n " ;
70+
6971 return p;
7072}
7173
@@ -78,11 +80,11 @@ HopperPipe *HopperEndpoint::add_output_pipe(const std::filesystem::path &path) {
7880 if (id == 0 )
7981 return nullptr ;
8082
81- std::cout << " OPEN OUT " << path << " \n " ;
82-
83- HopperPipe *p = new HopperPipe (id, PipeType::OUT, path, marker);
83+ HopperPipe *p = new HopperPipe (id, m_name, PipeType::OUT, path, marker);
8484 m_outputs[id] = p;
8585
86+ std::cout << " OPEN " << *p << " \n " ;
87+
8688 return p;
8789}
8890
@@ -92,15 +94,15 @@ void HopperEndpoint::remove_by_id(uint64_t pipe_id) {
9294 if (type == PipeType::IN && m_inputs.contains (pipe_id)) {
9395 HopperPipe *pipe = m_inputs[pipe_id];
9496 m_buffer.delete_marker (pipe->marker ());
95- std::cout << " CLOSE IN " << pipe-> path () << " \n " ;
96-
97+ std::cout << " CLOSE " << * pipe << " \n " ;
98+
9799 delete pipe;
98100 m_inputs.erase (pipe_id);
99101 } else if (type == PipeType::OUT && m_outputs.contains (pipe_id)) {
100102 HopperPipe *pipe = m_outputs[pipe_id];
101103 m_buffer.delete_marker (pipe->marker ());
102- std::cout << " CLOSE OUT " << pipe-> path () << " \n " ;
103-
104+ std::cout << " CLOSE " << * pipe << " \n " ;
105+
104106 delete pipe;
105107 m_outputs.erase (pipe_id);
106108 }
0 commit comments