Skip to content

Commit 3ece66c

Browse files
committed
remove send to all
1 parent 118c5ab commit 3ece66c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

example/chat_server_demo.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ chat_server_demo.cpp -lpthread -o chat_server
3838
#include "net_ip/io_type_decls.hpp"
3939

4040
using io_context = asio::io_context;
41+
using io_output = chops::net::tcp_io_output;
4142
using io_interface = chops::net::tcp_io_interface;
4243
using const_buf = asio::const_buffer;
4344
using endpoint = asio::ip::tcp::endpoint;
@@ -109,11 +110,12 @@ int main(int argc, char *argv[])
109110
wk.start();
110111

111112
// handles all @c io_interfaces
112-
chops::net::send_to_all<chops::net::tcp_io> sta;
113+
// REVIEW WITH CLIFF
114+
// chops::net::send_to_all<chops::net::tcp_io> sta;
113115

114116
/* lamda handlers */
115117
// receive text from client, send out to others
116-
const auto msg_hndlr = [&sta, finished, &DELIM](const_buf buf, io_interface iof, endpoint ep) {
118+
const auto msg_hndlr = [finished, &DELIM](const_buf buf, io_output io_out, endpoint ep) {
117119
if (finished) {
118120
return false;
119121
}
@@ -123,11 +125,14 @@ int main(int argc, char *argv[])
123125
if (s == "quit" + DELIM) {
124126
// send 'quit' to originator
125127
// originator needs message for io_state_change halt
126-
iof.send(buf.data(), buf.size());
128+
io_out.send(buf.data(), buf.size());
127129
} else {
128130
// not 'quit' (normal message)
129131
// so send message to all but originator
130-
sta.send(buf.data(), buf.size(), iof);
132+
// REVIEW WITH CLIFF - send to all?
133+
// sta.send(buf.data(), buf.size(), iof);
134+
// for now...
135+
io_out.send(buf.data(), buf.size());
131136
}
132137

133138
return true;

0 commit comments

Comments
 (0)