-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CommSession、CommTarget、CommService、CommConnection含义 #200
Comments
CommTarget是通讯目标,基本上就是ip+port, 还有两个超时参数。连接池什么的都在target里。 class MyHttpSession : public CommSession
{
private:
CommMessageOut *message_out() override { return new protocol::HttpRequest; }
CommMessageIn *message_in() override { return new protocol::HttpResponse; }
void handle(int state, int error) override
{
protocol::HttpResponse *resp = (protocol::HttpResponse *)this->get_message_in();
// print resp
...
delete this->get_message_out();
delete this->get_message_in();
delete this;
}
};
int main()
{
Communicator comm;
comm.init(2, 10);
CommTarget target;
target.init(...);
comm.request(new MyHttpSession, &target);
...
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Communicator.cc中的struct CommConnEntry中CommSession、CommTarget、CommService与CommConnection的含义?
![image](https://user-images.githubusercontent.com/18730685/103769614-8d706280-505f-11eb-8ea4-b6f8e55ef249.png)
The text was updated successfully, but these errors were encountered: