Skip to content

Commit

Permalink
Merge remote-tracking branch 'pepone/icessl-protocols' into icessl-pr…
Browse files Browse the repository at this point in the history
…otocols
  • Loading branch information
pepone committed Apr 5, 2024
2 parents dcb05b2 + f972201 commit 1749328
Show file tree
Hide file tree
Showing 550 changed files with 1,923 additions and 4,088 deletions.
2 changes: 1 addition & 1 deletion cpp/include/Ice/Connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ namespace Ice
class ICE_API Connection
{
public:
virtual ~Connection() = default;
virtual ~Connection() = 0;

/**
* Manually close the connection using the specified closure mode.
Expand Down
4 changes: 4 additions & 0 deletions cpp/include/IceUtil/ScannerConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@
#include "Config.h" // Required by generated Scanners.

#ifdef _MSC_VER
// Suppress the scanner's inclusion of the non-ANSI header file 'unistd.h'.
# define YY_NO_UNISTD_H

// Warning C4018: signed/unsigned mismatch
# pragma warning(disable : 4018)
// Warning C4244: conversion from `int` to `_Elem`, possible loss of data
# pragma warning(disable : 4244)
// warning C4267: conversion from 'size_t' to 'int', possible loss of data
// The result of fread() is a size_t and gets inserted into an int
# pragma warning(disable : 4267)
// Warning C4505: unreferenced function with internal linkage 'yy_fatal_error'
# pragma warning(disable : 4505)
#endif

#ifdef __clang__
Expand Down
8 changes: 6 additions & 2 deletions cpp/src/Ice/ACM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ IceInternal::FactoryACMMonitor::add(const ConnectionIPtr& connection)
if (_connections.empty())
{
_connections.insert(connection);
// We convert to milliseconds in case the timeout is only one or a few seconds; the division is an integral
// division.
_instance->timer()->scheduleRepeated(
shared_from_this(),
chrono::duration_cast<chrono::nanoseconds>(_config.timeout) / 2);
chrono::duration_cast<chrono::milliseconds>(_config.timeout) / 2);
}
else
{
Expand Down Expand Up @@ -301,7 +303,9 @@ IceInternal::ConnectionACMMonitor::add(const ConnectionIPtr& connection)
_connection = connection;
if (_config.timeout != chrono::seconds::zero())
{
_timer->scheduleRepeated(shared_from_this(), chrono::duration_cast<chrono::nanoseconds>(_config.timeout) / 2);
// We convert to milliseconds in case the timeout is only one or a few seconds; the division is an integral
// division.
_timer->scheduleRepeated(shared_from_this(), chrono::duration_cast<chrono::milliseconds>(_config.timeout) / 2);
}
}

Expand Down
40 changes: 22 additions & 18 deletions cpp/src/Ice/ACM.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,21 @@ namespace IceInternal
virtual Ice::ACM getACM() = 0;
};

class FactoryACMMonitor : public ACMMonitor, public std::enable_shared_from_this<FactoryACMMonitor>
class FactoryACMMonitor final : public ACMMonitor, public std::enable_shared_from_this<FactoryACMMonitor>
{
public:
FactoryACMMonitor(const InstancePtr&, const ACMConfig&);
virtual ~FactoryACMMonitor();
~FactoryACMMonitor() final;

virtual void add(const Ice::ConnectionIPtr&);
virtual void remove(const Ice::ConnectionIPtr&);
virtual void reap(const Ice::ConnectionIPtr&);
void add(const Ice::ConnectionIPtr&) final;
void remove(const Ice::ConnectionIPtr&) final;
void reap(const Ice::ConnectionIPtr&) final;

virtual ACMMonitorPtr
acm(const std::optional<int>&, const std::optional<Ice::ACMClose>&, const std::optional<Ice::ACMHeartbeat>&);
virtual Ice::ACM getACM();
ACMMonitorPtr
acm(const std::optional<int>&,
const std::optional<Ice::ACMClose>&,
const std::optional<Ice::ACMHeartbeat>&) final;
Ice::ACM getACM() final;

void destroy();
void swapReapedConnections(std::vector<Ice::ConnectionIPtr>&);
Expand All @@ -67,7 +69,7 @@ namespace IceInternal
void handleException(const std::exception&);
void handleException();

virtual void runTimerTask();
void runTimerTask() final;

InstancePtr _instance;
const ACMConfig _config;
Expand All @@ -79,22 +81,24 @@ namespace IceInternal
std::condition_variable _conditionVariable;
};

class ConnectionACMMonitor : public ACMMonitor, public std::enable_shared_from_this<ConnectionACMMonitor>
class ConnectionACMMonitor final : public ACMMonitor, public std::enable_shared_from_this<ConnectionACMMonitor>
{
public:
ConnectionACMMonitor(const FactoryACMMonitorPtr&, const IceUtil::TimerPtr&, const ACMConfig&);
virtual ~ConnectionACMMonitor();
~ConnectionACMMonitor() final;

virtual void add(const Ice::ConnectionIPtr&);
virtual void remove(const Ice::ConnectionIPtr&);
virtual void reap(const Ice::ConnectionIPtr&);
void add(const Ice::ConnectionIPtr&) final;
void remove(const Ice::ConnectionIPtr&) final;
void reap(const Ice::ConnectionIPtr&) final;

virtual ACMMonitorPtr
acm(const std::optional<int>&, const std::optional<Ice::ACMClose>&, const std::optional<Ice::ACMHeartbeat>&);
virtual Ice::ACM getACM();
ACMMonitorPtr
acm(const std::optional<int>&,
const std::optional<Ice::ACMClose>&,
const std::optional<Ice::ACMHeartbeat>&) final;
Ice::ACM getACM() final;

private:
virtual void runTimerTask();
void runTimerTask() final;

const FactoryACMMonitorPtr _parent;
const IceUtil::TimerPtr _timer;
Expand Down
2 changes: 2 additions & 0 deletions cpp/src/Ice/Connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using namespace Ice;
using namespace std;

Ice::Connection::~Connection() {}

void
Ice::Connection::flushBatchRequests(CompressBatch compress)
{
Expand Down
6 changes: 0 additions & 6 deletions cpp/src/Ice/ConnectionI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,12 +865,6 @@ namespace
};
}

void
Ice::ConnectionI::heartbeat()
{
Connection::heartbeatAsync().get();
}

std::function<void()>
Ice::ConnectionI::heartbeatAsync(::std::function<void(::std::exception_ptr)> ex, ::std::function<void(bool)> sent)
{
Expand Down
56 changes: 28 additions & 28 deletions cpp/src/Ice/ConnectionI.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ namespace Ice
class ObjectAdapterI;
using ObjectAdapterIPtr = std::shared_ptr<ObjectAdapterI>;

class ConnectionI : public Connection, public IceInternal::EventHandler, public IceInternal::CancellationHandler
class ConnectionI final : public Connection,
public IceInternal::EventHandler,
public IceInternal::CancellationHandler
{
class Observer : public IceInternal::ObserverHelperT<Ice::Instrumentation::ConnectionObserver>
{
Expand Down Expand Up @@ -133,12 +135,12 @@ namespace Ice
void activate();
void hold();
void destroy(DestructionReason);
virtual void close(ConnectionClose) noexcept; // From Connection.
void close(ConnectionClose) noexcept final; // From Connection.

bool isActiveOrHolding() const;
bool isFinished() const;

virtual void throwException() const; // From Connection. Throws the connection exception if destroyed.
void throwException() const final; // From Connection. Throws the connection exception if destroyed.

void waitUntilHolding() const;
void waitUntilFinished(); // Not const, as this might close the connection upon timeout.
Expand All @@ -151,32 +153,30 @@ namespace Ice

const IceInternal::BatchRequestQueuePtr& getBatchRequestQueue() const;

virtual std::function<void()> flushBatchRequestsAsync(
std::function<void()> flushBatchRequestsAsync(
CompressBatch,
std::function<void(std::exception_ptr)>,
std::function<void(bool)> = nullptr);
std::function<void(bool)> = nullptr) final;

virtual void setCloseCallback(CloseCallback);
virtual void setHeartbeatCallback(HeartbeatCallback);
void setCloseCallback(CloseCallback) final;
void setHeartbeatCallback(HeartbeatCallback) final;

virtual void heartbeat();
std::function<void()>
heartbeatAsync(std::function<void(std::exception_ptr)>, std::function<void(bool)> = nullptr) final;

virtual std::function<void()>
heartbeatAsync(std::function<void(std::exception_ptr)>, std::function<void(bool)> = nullptr);
void
setACM(const std::optional<int>&, const std::optional<ACMClose>&, const std::optional<ACMHeartbeat>&) final;
ACM getACM() noexcept final;

virtual void
setACM(const std::optional<int>&, const std::optional<ACMClose>&, const std::optional<ACMHeartbeat>&);
virtual ACM getACM() noexcept;

virtual void asyncRequestCanceled(const IceInternal::OutgoingAsyncBasePtr&, std::exception_ptr);
void asyncRequestCanceled(const IceInternal::OutgoingAsyncBasePtr&, std::exception_ptr) final;

IceInternal::EndpointIPtr endpoint() const;
IceInternal::ConnectorPtr connector() const;

virtual void setAdapter(const ObjectAdapterPtr&); // From Connection.
virtual ObjectAdapterPtr getAdapter() const noexcept; // From Connection.
virtual EndpointPtr getEndpoint() const noexcept; // From Connection.
virtual ObjectPrx createProxy(const Identity& ident) const; // From Connection.
void setAdapter(const ObjectAdapterPtr&) final; // From Connection.
ObjectAdapterPtr getAdapter() const noexcept final; // From Connection.
EndpointPtr getEndpoint() const noexcept final; // From Connection.
ObjectPrx createProxy(const Identity& ident) const final; // From Connection.

void setAdapterFromAdapter(const ObjectAdapterIPtr&); // From ObjectAdapterI.

Expand All @@ -188,18 +188,18 @@ namespace Ice
bool finishAsync(IceInternal::SocketOperation);
#endif

virtual void message(IceInternal::ThreadPoolCurrent&);
virtual void finished(IceInternal::ThreadPoolCurrent&, bool);
virtual std::string toString() const noexcept; // From Connection and EvantHandler.
virtual IceInternal::NativeInfoPtr getNativeInfo();
void message(IceInternal::ThreadPoolCurrent&) final;
void finished(IceInternal::ThreadPoolCurrent&, bool) final;
std::string toString() const noexcept final; // From Connection and EventHandler.
IceInternal::NativeInfoPtr getNativeInfo() final;

void timedOut();

virtual std::string type() const noexcept; // From Connection.
virtual std::int32_t timeout() const noexcept; // From Connection.
virtual ConnectionInfoPtr getInfo() const; // From Connection
std::string type() const noexcept final; // From Connection.
std::int32_t timeout() const noexcept final; // From Connection.
ConnectionInfoPtr getInfo() const final; // From Connection

virtual void setBufferSize(std::int32_t rcvSize, std::int32_t sndSize); // From Connection
void setBufferSize(std::int32_t rcvSize, std::int32_t sndSize) final; // From Connection

void exception(std::exception_ptr);

Expand All @@ -217,7 +217,7 @@ namespace Ice

void closeCallback(const CloseCallback&);

virtual ~ConnectionI();
~ConnectionI() final;

private:
ConnectionI(
Expand Down
26 changes: 13 additions & 13 deletions cpp/src/IceGrid/Internal.ice
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ interface Adapter
/// Get the adapter direct proxy. The adapter direct proxy is a proxy created with the object adapter. The proxy
/// contains the last known adapter endpoints.
/// @return A direct proxy containing the last known adapter endpoints if the adapter is already active.
["nonmutating", "cpp:const"] idempotent Object* getDirectProxy()
["cpp:const"] idempotent Object* getDirectProxy()
throws AdapterNotActiveException;

/// Set the direct proxy for this adapter.
Expand Down Expand Up @@ -172,7 +172,7 @@ interface Server extends FileReader
void setEnabled(bool enable);

/// Check if the server is enabled.
["nonmutating", "cpp:const"] idempotent bool isEnabled();
["cpp:const"] idempotent bool isEnabled();

/// Send signal to the server
void sendSignal(string signal)
Expand All @@ -184,11 +184,11 @@ interface Server extends FileReader
/// Return the server state.
/// @return The server state.
/// @see ServerState
["nonmutating", "cpp:const"] idempotent ServerState getState();
["cpp:const"] idempotent ServerState getState();

/// Get the server pid. Note that the value returned by this method is system dependant. On Unix operating systems,
/// it's the pid value returned by the fork() system call and converted to an integer.
["nonmutating", "cpp:const"] idempotent int getPid();
["cpp:const"] idempotent int getPid();

/// Set the process proxy.
["amd"] void setProcess(Ice::Process* proc);
Expand Down Expand Up @@ -243,19 +243,19 @@ interface Node extends FileReader, ReplicaObserver
void registerWithReplica(InternalRegistry* replica);

/// Get the node name.
["nonmutating", "cpp:const"] idempotent string getName();
["cpp:const"] idempotent string getName();

/// Get the node hostname.
["nonmutating", "cpp:const"] idempotent string getHostname();
["cpp:const"] idempotent string getHostname();

/// Get the node load.
["nonmutating", "cpp:const"] idempotent LoadInfo getLoad();
["cpp:const"] idempotent LoadInfo getLoad();

/// Get the number of processor sockets for the machine where this node is running.
["nonmutating", "cpp:const"] idempotent int getProcessorSocketCount();
["cpp:const"] idempotent int getProcessorSocketCount();

/// Shutdown the node.
["nonmutating", "cpp:const"] idempotent void shutdown();
["cpp:const"] idempotent void shutdown();
}

sequence<Node*> NodePrxSeq;
Expand All @@ -275,16 +275,16 @@ interface NodeSession
void setReplicaObserver(ReplicaObserver* observer);

/// Return the node session timeout.
["nonmutating", "cpp:const"] idempotent int getTimeout();
["cpp:const"] idempotent int getTimeout();

/// Return the node observer.
["nonmutating", "cpp:const"] idempotent NodeObserver* getObserver();
["cpp:const"] idempotent NodeObserver* getObserver();

/// Ask the registry to load the servers on the node.
["amd", "nonmutating", "cpp:const"] idempotent void loadServers();
["amd", "cpp:const"] idempotent void loadServers();

/// Get the name of the servers deployed on the node.
["nonmutating", "cpp:const"] idempotent Ice::StringSeq getServers();
["cpp:const"] idempotent Ice::StringSeq getServers();

/// Wait for the application update to complete (the application is completely updated once all the registry
/// replicas have been updated). This is used by the node to ensure that before to start a server all the
Expand Down
Loading

0 comments on commit 1749328

Please sign in to comment.