Skip to content
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

Replace ConnectionTimeoutException by ConnectionIdleException #2078

Merged
merged 5 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions cpp/include/Ice/LocalException.h
Original file line number Diff line number Diff line change
Expand Up @@ -1291,10 +1291,10 @@ namespace Ice
};

/**
* This exception indicates a timeout condition.
* This exception indicates that a connection was aborted by the idle check.
* \headerfile Ice/Ice.h
*/
class ICE_API TimeoutException : public LocalException
class ICE_API ConnectionIdleException : public LocalException
{
public:
using LocalException::LocalException;
Expand All @@ -1311,13 +1311,13 @@ namespace Ice
};

/**
* This exception indicates a connection establishment timeout condition.
* This exception indicates a timeout condition.
* \headerfile Ice/Ice.h
*/
class ICE_API ConnectTimeoutException : public TimeoutException
class ICE_API TimeoutException : public LocalException
{
public:
using TimeoutException::TimeoutException;
using LocalException::LocalException;

/**
* Obtains the Slice type ID of this exception.
Expand All @@ -1331,10 +1331,10 @@ namespace Ice
};

/**
* This exception indicates a connection closure timeout condition.
* This exception indicates a connection establishment timeout condition.
* \headerfile Ice/Ice.h
*/
class ICE_API CloseTimeoutException : public TimeoutException
class ICE_API ConnectTimeoutException : public TimeoutException
{
public:
using TimeoutException::TimeoutException;
Expand All @@ -1351,10 +1351,10 @@ namespace Ice
};

/**
* This exception indicates that a connection has been shut down because it has been idle for some time.
* This exception indicates a connection closure timeout condition.
* \headerfile Ice/Ice.h
*/
class ICE_API ConnectionTimeoutException : public TimeoutException
class ICE_API CloseTimeoutException : public TimeoutException
{
public:
using TimeoutException::TimeoutException;
Expand Down
17 changes: 8 additions & 9 deletions cpp/src/Ice/ConnectionI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, exc
{
rethrow_exception(ex);
}
catch (const Ice::ConnectionTimeoutException&)
catch (const ConnectionIdleException&)
{
setState(StateClosed, ex);
}
Expand Down Expand Up @@ -939,7 +939,7 @@ Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, exc
{
rethrow_exception(ex);
}
catch (const Ice::ConnectionTimeoutException&)
catch (const ConnectionIdleException&)
{
setState(StateClosed, ex);
}
Expand All @@ -964,7 +964,7 @@ Ice::ConnectionI::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, exc
{
rethrow_exception(ex);
}
catch (const Ice::ConnectionTimeoutException&)
catch (const ConnectionIdleException&)
{
setState(StateClosed, ex);
}
Expand Down Expand Up @@ -1659,7 +1659,7 @@ Ice::ConnectionI::finish(bool close)
catch (const ConnectionManuallyClosedException&)
{
}
catch (const ConnectionTimeoutException&)
catch (const ConnectionIdleException&)
{
}
catch (const CommunicatorDestroyedException&)
Expand Down Expand Up @@ -2000,7 +2000,7 @@ Ice::ConnectionI::setState(State state, exception_ptr ex)
catch (const ConnectionManuallyClosedException&)
{
}
catch (const ConnectionTimeoutException&)
catch (const ConnectionIdleException&)
{
}
catch (const CommunicatorDestroyedException&)
Expand Down Expand Up @@ -2178,7 +2178,7 @@ Ice::ConnectionI::setState(State state)
catch (const ConnectionManuallyClosedException&)
{
}
catch (const ConnectionTimeoutException&)
catch (const ConnectionIdleException&)
{
}
catch (const CommunicatorDestroyedException&)
Expand Down Expand Up @@ -2298,13 +2298,12 @@ Ice::ConnectionI::idleCheck(
if (_instance->traceLevels()->network >= 1)
{
Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat);
out << "connection aborted by idle check because it did not receive any byte for "
out << "connection aborted by the idle check because it did not receive any byte for "
<< idleTimeout.count() << "s\n";
out << _transceiver->toDetailedString();
}

// TODO: replace by ConnectionIdleException.
setState(StateClosed, make_exception_ptr(TimeoutException(__FILE__, __LINE__)));
setState(StateClosed, make_exception_ptr(ConnectionIdleException(__FILE__, __LINE__)));
}
}
// else, nothing to do
Expand Down
38 changes: 19 additions & 19 deletions cpp/src/Ice/LocalException.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,54 +484,54 @@ Ice::OperationInterruptedException::ice_staticId() noexcept
}

string
Ice::TimeoutException::ice_id() const
Ice::ConnectionIdleException::ice_id() const
{
return string{ice_staticId()};
}

string_view
Ice::TimeoutException::ice_staticId() noexcept
Ice::ConnectionIdleException::ice_staticId() noexcept
{
static constexpr string_view typeId = "::Ice::TimeoutException";
static constexpr string_view typeId = "::Ice::ConnectionIdleException";
return typeId;
}

string
Ice::ConnectTimeoutException::ice_id() const
Ice::TimeoutException::ice_id() const
{
return string{ice_staticId()};
}

string_view
Ice::ConnectTimeoutException::ice_staticId() noexcept
Ice::TimeoutException::ice_staticId() noexcept
{
static constexpr string_view typeId = "::Ice::ConnectTimeoutException";
static constexpr string_view typeId = "::Ice::TimeoutException";
return typeId;
}

string
Ice::CloseTimeoutException::ice_id() const
Ice::ConnectTimeoutException::ice_id() const
{
return string{ice_staticId()};
}

string_view
Ice::CloseTimeoutException::ice_staticId() noexcept
Ice::ConnectTimeoutException::ice_staticId() noexcept
{
static constexpr string_view typeId = "::Ice::CloseTimeoutException";
static constexpr string_view typeId = "::Ice::ConnectTimeoutException";
return typeId;
}

string
Ice::ConnectionTimeoutException::ice_id() const
Ice::CloseTimeoutException::ice_id() const
{
return string{ice_staticId()};
}

string_view
Ice::ConnectionTimeoutException::ice_staticId() noexcept
Ice::CloseTimeoutException::ice_staticId() noexcept
{
static constexpr string_view typeId = "::Ice::ConnectionTimeoutException";
static constexpr string_view typeId = "::Ice::CloseTimeoutException";
return typeId;
}

Expand Down Expand Up @@ -1124,6 +1124,13 @@ Ice::OperationInterruptedException::ice_print(ostream& out) const
out << ":\noperation interrupted";
}

void
Ice::ConnectionIdleException::ice_print(ostream& out) const
{
Exception::ice_print(out);
out << ":\nconnection aborted by the idle check";
}

void
Ice::TimeoutException::ice_print(ostream& out) const
{
Expand All @@ -1145,13 +1152,6 @@ Ice::CloseTimeoutException::ice_print(ostream& out) const
out << ":\ntimeout while closing a connection";
}

void
Ice::ConnectionTimeoutException::ice_print(ostream& out) const
{
Exception::ice_print(out);
out << ":\nconnection has timed out";
}

void
Ice::InvocationTimeoutException::ice_print(ostream& out) const
{
Expand Down
2 changes: 1 addition & 1 deletion cpp/test/Ice/idleTimeout/AllTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ testEnableDisableIdleCheck(bool enabled, const string& proxyString, const Proper
p->sleep(2000); // the implementation in the server sleeps for 2,000ms
test(!enabled);
}
catch (const TimeoutException&)
catch (const ConnectionIdleException&)
{
test(enabled);
}
Expand Down
22 changes: 22 additions & 0 deletions matlab/lib/+Ice/ConnectionIdleException.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
% ConnectionIdleException Summary of ConnectionIdleException
%
% This exception indicates that a connection was aborted by the idle check.

% Copyright (c) ZeroC, Inc. All rights reserved.

classdef ConnectionIdleException < Ice.LocalException
methods
function obj = ConnectionIdleException(ice_exid, ice_exmsg)
if nargin == 0 || isempty(ice_exid)
ice_exid = 'Ice:ConnectionIdleException';
end
if nargin < 2 || isempty(ice_exmsg)
ice_exmsg = 'Ice.ConnectionIdleException';
end
obj = [email protected](ice_exid, ice_exmsg);
end
function id = ice_id(~)
id = '::Ice::ConnectionIdleException';
end
end
end
23 changes: 0 additions & 23 deletions matlab/lib/+Ice/ConnectionTimeoutException.m

This file was deleted.

Loading