15
15
*/
16
16
17
17
#include < cstddef> // std::size_t
18
+ #include < cstdlib> // std::exit
18
19
#include < utility> // std::move
19
20
#include < thread>
20
21
#include < future>
39
40
#include " test_data_blaster/dsr_args.hpp"
40
41
#include " test_data_blaster/monitor_msg_handling.hpp"
41
42
42
- const std::string_view msg_prefix { " Tasty testing !" };
43
+ const std::string_view msg_prefix { " Tasty!" };
43
44
44
45
void send_mon_msg (chops::test::monitor_connector& mon,
45
46
chops::test::monitor_msg_data& mon_msg,
@@ -58,15 +59,14 @@ void send_mon_msg (chops::test::monitor_connector& mon,
58
59
mon_msg.m_outgoing_queue_size = oqs ? (*oqs).output_queue_size : 0u ;
59
60
// mon.send_monitor_msg(mon_msg);
60
61
// temporary display until monitor functionality is ready
61
- std::cerr << " Mon msg : " << mon_msg.m_dsr_name << " , " <<
62
+ std::cerr << " Mon: " << mon_msg.m_dsr_name << " , " <<
62
63
mon_msg.m_protocol << " , " <<
63
64
mon_msg.m_remote_addr << " , " <<
64
65
(mon_msg.m_direction == chops::test::monitor_msg_data::incoming ? " incoming, " : " outgoing, " ) <<
65
66
mon_msg.m_curr_msg_num << " /" << mon_msg.m_total_msgs_to_send << " , " <<
66
- mon_msg.m_curr_msg_size << " , " <<
67
- mon_msg.m_curr_msg_beginning << " , " <<
68
- mon_msg.m_outgoing_queue_size << std::endl;
69
-
67
+ mon_msg.m_curr_msg_size << " , q sz: " <<
68
+ mon_msg.m_outgoing_queue_size << " , " <<
69
+ mon_msg.m_curr_msg_beginning << std::endl;
70
70
}
71
71
}
72
72
@@ -181,6 +181,29 @@ void start_entity (chops::net::net_entity ent, char body_char,
181
181
// 8 - host, if connector
182
182
auto temp_parse_cmd (int argc, char * argv[]) {
183
183
184
+ if (argc < 8 ) {
185
+ std::cerr << " Parameters (temporary):" << ' \n ' <<
186
+ " name R/n mod cnt delay A/C port (host)" << ' \n ' <<
187
+ " where:" << ' \n ' <<
188
+ " name = DSR name" << ' \n ' <<
189
+ " R = reply (anything else means no reply)" << ' \n ' <<
190
+ " mod = display modulo number" << ' \n ' <<
191
+ " cnt = send count (0 for receive only)" << ' \n ' <<
192
+ " delay = delay in milliseconds between sends (ignored if send count is 0)" << ' \n ' <<
193
+ " A/C = A for acceptor, C for connector" << ' \n ' <<
194
+ " port = port number (for either acceptor or connector)" << ' \n ' <<
195
+ " host = if connector, host name or IP number" << ' \n ' << std::endl;
196
+ std::exit (0 );
197
+ }
198
+ // 1 - dsr name
199
+ // 2 - R for reply
200
+ // 3 - mod
201
+ // 4 - send count
202
+ // 5 - delay
203
+ // 6 - A for acceptor, C for connector
204
+ // 7 - port
205
+ // 8 - host, if connector
206
+
184
207
chops::test::tcp_dsr_args parms;
185
208
parms.m_dsr_name = std::string (argv[1 ]);
186
209
parms.m_reply = (*(argv[2 ]) == ' R' );
@@ -234,6 +257,9 @@ int main (int argc, char* argv[]) {
234
257
start_entity (ent, body_char++, parms, send_futs, mon, mon_msg, err_wq);
235
258
}
236
259
260
+ // temporary - wait a while, then cause future to pop
261
+ std::this_thread::sleep_for (std::chrono::minutes (1 ));
262
+ mon.shutdown ();
237
263
// everything up and running, block waiting on shutdown msg
238
264
shutdown_fut.get (); // monitor sent shutdown msg
239
265
nip.stop_all (); // stop all entities
0 commit comments