Skip to content

Commit 56ab1a6

Browse files
Put temporary code in for command line parms and mon connection, for first level DSR testing.
1 parent c37c00f commit 56ab1a6

File tree

1 file changed

+45
-3
lines changed

1 file changed

+45
-3
lines changed

test/test_data_blaster/tcp_dsr.cpp

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <chrono>
2222
#include <functional> // std::ref, std::cref
2323
#include <string_view>
24+
#include <string>
2425
#include <algorithm> // std::min
2526

2627
#include <iostream> // std::cerr for error sink
@@ -35,7 +36,7 @@
3536
#include "shared_test/msg_handling.hpp"
3637
#include "marshall/shared_buffer.hpp"
3738

38-
#include "test_data_blaster/tcp_dsr_args.hpp"
39+
#include "test_data_blaster/dsr_args.hpp"
3940
#include "test_data_blaster/monitor_msg_handling.hpp"
4041

4142
const std::string_view msg_prefix { "Tasty testing!" };
@@ -55,7 +56,17 @@ void send_mon_msg (chops::test::monitor_connector& mon,
5556
std::min(chops::test::monitor_msg_data::max_msg_data_to_capture, (msg_size - 2u)));
5657
auto oqs = io_out.get_output_queue_stats();
5758
mon_msg.m_outgoing_queue_size = oqs ? (*oqs).output_queue_size : 0u;
58-
mon.send_monitor_msg(mon_msg);
59+
// mon.send_monitor_msg(mon_msg);
60+
// temporary display until monitor functionality is ready
61+
std::cerr << "Mon msg: " << mon_msg.m_dsr_name << ", " <<
62+
mon_msg.m_protocol << ", " <<
63+
mon_msg.m_remote_addr << ", " <<
64+
(m_direction == chops;:monitor_msg_data::incoming ? "incoming, " : "outgoing, ") <<
65+
mon_msg.m_curr_msg_num << "/" << mon_msg.m_total_msgs_to_send ", " <<
66+
mon_msg.curr_msg_size << ", " <<
67+
mon_msg.curr_msg_beginning << ", " <<
68+
mon_msg.m_outgoing_queue_size << std::endl;
69+
5970
}
6071
}
6172

@@ -159,9 +170,39 @@ void start_entity (chops::net::net_entity ent, char body_char,
159170
chops::net::make_error_func_with_wait_queue<chops::net::tcp_io>(err_wq));
160171
}
161172

173+
// temporary command line parsing while production version is being developed
174+
// 1 - dsr name
175+
// 2 - R means reply is true, anything else not
176+
// 3 - mod
177+
// 4 - send count
178+
// 5 - delay
179+
// 6 - A means acceptor, C means connector
180+
// 7 - port
181+
// 8 - host, if connector
182+
auto temp_parse_cmd (int argc, char* argv[]) {
183+
184+
chops::test::args parms;
185+
parms.m_dsr_name = std::string(argv[1]);
186+
parms.m_reply = (*(argv[2]) == 'R');
187+
parms.m_modulus = std::stoi(std::string(argv[3]));
188+
parms.m_send_count = std::stoi(std::string(argv[4]));
189+
parms.m_delay = std::chrono::milliseconds(std::stoi(std::string(argv[5])));
190+
std::string port { argv[7] };
191+
if (argv[6] == 'A') {
192+
parms.m_acceptors.push_back(port);
193+
}
194+
else {
195+
std::string host { argv[8] };
196+
parms.m_connectors.push_back(chops::test::connector_info(port, host));
197+
}
198+
199+
return parms;
200+
}
201+
162202
int main (int argc, char* argv[]) {
163203

164-
auto parms = chops::test::parse_command_line(argc, argv);
204+
// auto parms = chops::test::parse_command_line(argc, argv);
205+
auto parms - temp_pars_cmd (argc, argv);
165206

166207
char body_char { 'a' };
167208

@@ -212,5 +253,6 @@ int main (int argc, char* argv[]) {
212253
std::cerr << "TCP DSR " << parms.m_dsr_name <<
213254
", shutting down, num error logs displayed: " << err_cnt << std::endl;
214255

256+
return 0;
215257
}
216258

0 commit comments

Comments
 (0)