Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into remove-serialize
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier committed Sep 5, 2024
2 parents 61399ff + b6ac65f commit 1038929
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
27 changes: 21 additions & 6 deletions cpp/src/Ice/ConnectionI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,31 +512,46 @@ Ice::ConnectionI::close(function<void()> response, function<void(std::exception_
}
}

if (closeException) // already closed
if ((response || exception) && closeException) // already closed
{
bool success = false;
try
{
rethrow_exception(closeException);
}
catch (const ConnectionClosedException&)
{
response();
success = true;
}
catch (const CloseConnectionException&)
{
response();
success = true;
}
catch (const CommunicatorDestroyedException&)
{
response();
success = true;
}
catch (const ObjectAdapterDeactivatedException&)
{
response();
success = true;
}
catch (...)
{
exception(closeException);
}

if (success)
{
if (response)
{
response();
}
}
else
{
if (exception)
{
exception(closeException);
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions cpp/test/Ice/timeout/AllTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ allTestsWithController(Test::TestHelper* helper, const ControllerPrx& controller
{
// Expected.
}

// Verify closing a closed connection is fine.
connection->close(nullptr, nullptr);

controller->resumeAdapter();
timeout->op(); // Ensure adapter is active.
}
Expand Down

0 comments on commit 1038929

Please sign in to comment.