wwbmmm commented on issue #2424: URL: https://github.com/apache/brpc/issues/2424#issuecomment-1782218262
ServerOptions.auth 这个倒是可以在每次新建连接的时候被调用,这就可以实现OnNewConnection的回调。而且可以返回一个AuthContext,这个AuthContext可以通过后续的请求的Controller中拿到。这个AuthContext会存在Socket对象中,当Socket回收(即连接断开)时,AuthContext会被释放。如果把AuthContext的析构函数改为虚函数,允许子类自定义析构的逻辑,是不是就可以实现OnClosedConnection的回调了? https://github.com/apache/brpc/blob/master/src/brpc/authenticator.h#L30 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org