File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
orm_lib/src/postgresql_impl Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,15 @@ void PgConnection::handleClosed()
133133 if (status_ == ConnectStatus::Bad)
134134 return ;
135135 status_ = ConnectStatus::Bad;
136+
137+ if (isWorking_)
138+ {
139+ // Connection was closed unexpectedly during isWorking_ while were true.
140+ isWorking_ = false ;
141+ handleFatalError ();
142+ callback_ = nullptr ;
143+ }
144+
136145 channel_.disableAll ();
137146 channel_.remove ();
138147 assert (closeCallback_);
@@ -406,10 +415,13 @@ void PgConnection::doAfterPreparing()
406415
407416void PgConnection::handleFatalError ()
408417{
409- auto exceptPtr =
410- std::make_exception_ptr (Failure (PQerrorMessage (connectionPtr_.get ())));
411418 if (exceptionCallback_)
419+ {
420+ auto exceptPtr = std::make_exception_ptr (
421+ Failure (PQerrorMessage (connectionPtr_.get ())));
412422 exceptionCallback_ (exceptPtr);
423+ }
424+
413425 exceptionCallback_ = nullptr ;
414426}
415427
You can’t perform that action at this time.
0 commit comments