Postgresql: don't handle events anymore after connection closing (#1499)

This commit is contained in:
An Tao 2023-02-04 20:06:15 +08:00 committed by GitHub
parent 7d87d7e0b2
commit ae9d5f20b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -94,6 +94,10 @@ PgConnection::PgConnection(trantor::EventLoop *loop,
exit(1);
}
channel_.setReadCallback([this]() {
if (status_ == ConnectStatus::Bad)
{
return;
}
if (status_ != ConnectStatus::Ok)
{
pgPoll();

View File

@ -72,6 +72,10 @@ PgConnection::PgConnection(trantor::EventLoop *loop,
exit(1);
}
channel_.setReadCallback([this]() {
if (status_ == ConnectStatus::Bad)
{
return;
}
if (status_ != ConnectStatus::Ok)
{
pgPoll();