Skip to content

Commit 9e06319

Browse files
committed
srv.cpp
1 parent bbe96fd commit 9e06319

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

section5/srv.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ try
5959

6060
for(;;) {
6161

62-
// shared_ptr/unique_ptr
62+
// xxx : shared_ptr/unique_ptr
6363
auto msg_ptr = std::make_shared<zmq_message_type>();
6464

6565
sock.recv(msg_ptr.get());
@@ -75,6 +75,7 @@ try
7575

7676
SalesData book;
7777

78+
// xxx: json/msgpack/protobuf
7879
auto obj = msgpack::unpack(
7980
ptr->data<char>(), ptr->size()).get();
8081
obj.convert(book);
@@ -87,9 +88,9 @@ try
8788
++count;
8889
cout << count << endl;
8990
},
90-
msg_ptr);
91-
}
92-
};
91+
msg_ptr); // async
92+
} // for(;;)
93+
}; // recv_cycle lambda
9394

9495
auto log_cycle = [&]()
9596
{
@@ -115,8 +116,8 @@ try
115116
if (res.status_code != 200) {
116117
cout << "http post failed" << endl;
117118
}
118-
}
119-
};
119+
} // for(;;)
120+
}; // log_cycle lambda
120121

121122
// launch recv_cycle then wait
122123
auto fu = std::async(std::launch::async,

0 commit comments

Comments
 (0)