mirror of
https://github.com/qicosmos/rest_rpc.git
synced 2026-08-30 17:10:50 +08:00
add user data in connection.
This commit is contained in:
@@ -7,6 +7,13 @@ using namespace rpc_service;
|
||||
|
||||
struct dummy{
|
||||
int add(rpc_conn conn, int a, int b) {
|
||||
auto shared_conn = conn.lock();
|
||||
if (shared_conn) {
|
||||
shared_conn->set_user_data(std::string("aa"));
|
||||
auto s = conn.lock()->get_user_data<std::string>();
|
||||
std::cout << s << '\n'; //aa
|
||||
}
|
||||
|
||||
return a + b;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user