Thanks for you recommendations, I will study it (ServerContext:auth_context, ServerContext::peer) and give replies if they can help.
Actually, I'm doing a project to optimize grpc with rdma. Finsh/FinalizeResult are the places to serialize/deserialize message from/to user to/from grpc internal buffer. But if we use rdma, rdma has its registered buffer to send/receive message, and each connection has its own rdma registered buffer. So, inside serialization/deserialization, i have to move data to/from rdma registered buffer, instead of grpc internal buffer. What's why i need to figure out connection in Finish/FinalizeResult, becuase I have to select which rdma buffer I should use. 在2021年11月22日星期一 UTC-5 22:33:02<[email protected]> 写道: > On Monday, November 22, 2021 at 7:09:22 PM UTC-8 [email protected] wrote: > > > I didn't have any hint to locate which connection/fd from this 'tag'. I > > think grpc have some record to pair this 'tag' with connection. And if > one > > client send multiple requests, each request has its own 'tag', but grpc > > will find the connection/fd from these tags. So I think I have to find > > this 'tag' - connection map inside grpc. But not find yet. Please correct > > me if i'm wrong. > > Ah. You're asking about things like "which client is on the other end of > this call". Look at ServerContext::auth_context [1] and ServerContext::peer > [2]. My memory of exactly how Finish and FinializeResult work together is > hazy. If you no longer have access to the ServerContext when > Finish/FinializeResult is running, you'll need to copy the value you need > from the ServerContext into whatever per-tag data structure you use. > > Consider, though, whether you need to be tracking the connection on a "per > socket"/"per fd" level or if you need to be tracking a "connection" at a > higher level, like a single user's "session" in your service. What should > the behavior be in the client device changes networks, like switching from > a > cell connection to a WiFi connection? Are those different "connections" or > the same? > > [1]: > https://grpc.github.io/grpc/cpp/classgrpc_1_1_server_context.html#a2b28535186cbe2d7b6ed1ff59980191b > [2]: > https://grpc.github.io/grpc/cpp/classgrpc_1_1_server_context.html#a6e94cf9e11550b34ab98271202f03adc > > -- > Christopher Warrington > Microsoft Corp. > > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/656dc2ad-20ca-459a-8eea-7b5fd4b2693bn%40googlegroups.com.
