Skip to content

Commit bf245b1

Browse files
allign to newer object-core (#78)
* allign to newer object-core
1 parent d8da8bf commit bf245b1

File tree

6 files changed

+6
-46
lines changed

6 files changed

+6
-46
lines changed

goldenmaster/apigear/olink/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if(NOT objectlink-core-cpp_FOUND)
1313
message(STATUS "objectlink-core-cpp NOT FOUND, fetching the git repository")
1414
FetchContent_Declare(olink-core
1515
GIT_REPOSITORY https://github.com/apigear-io/objectlink-core-cpp.git
16-
GIT_TAG v0.2.1
16+
GIT_TAG v0.2.4
1717
GIT_SHALLOW TRUE
1818
EXCLUDE_FROM_ALL FALSE
1919
)

goldenmaster/apigear/olink/private/olinkremote.cpp

+1-13
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ namespace PocoImpl {
1616
OLinkRemote::OLinkRemote(std::unique_ptr<Poco::Net::WebSocket> socket, IConnectionStorage& connectionStorage, ApiGear::ObjectLink::RemoteRegistry& registry)
1717
: m_socket(*this),
1818
m_connectionStorage(connectionStorage),
19-
m_node(ApiGear::ObjectLink::RemoteNode::createRemoteNode(registry)),
20-
m_registry(registry)
19+
m_node(ApiGear::ObjectLink::RemoteNode::createRemoteNode(registry))
2120
{
2221
m_node->onLog(m_log.logFunc());
2322
m_node->onWrite([this](std::string msg) {
@@ -28,7 +27,6 @@ OLinkRemote::OLinkRemote(std::unique_ptr<Poco::Net::WebSocket> socket, IConnecti
2827

2928
OLinkRemote::~OLinkRemote()
3029
{
31-
removeNodeFromRegistryIfNotUnlikend();
3230
if(!m_socket.isClosed())
3331
{
3432
m_socket.close();
@@ -46,7 +44,6 @@ void OLinkRemote::handleTextMessage(const std::string& msg)
4644

4745
void OLinkRemote::onConnectionClosedFromNetwork()
4846
{
49-
removeNodeFromRegistryIfNotUnlikend();
5047
m_connectionStorage.notifyConnectionClosed();
5148
}
5249

@@ -55,13 +52,4 @@ bool OLinkRemote::isClosed() const
5552
return m_socket.isClosed();
5653
}
5754

58-
void OLinkRemote::removeNodeFromRegistryIfNotUnlikend()
59-
{
60-
auto objectsUsingNode = m_registry.getObjectIds(m_node);
61-
for (auto objectId : objectsUsingNode)
62-
{
63-
m_registry.removeNodeFromSource(m_node, objectId);
64-
}
65-
}
66-
6755
}} //namespace ApiGear::PocoImpl

goldenmaster/apigear/olink/private/olinkremote.h

+1-9
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,6 @@ class OLinkRemote : public ISocketUser
5959
*/
6060
void onConnectionClosedFromNetwork() override;
6161
private:
62-
63-
/**
64-
* Call this function when closing connection.
65-
* Removes the node from registry, for objects which didn't got the unlink message for this connection.
66-
*/
67-
void removeNodeFromRegistryIfNotUnlikend();
68-
6962
/**A socket used for this connection.*/
7063
SocketWrapper m_socket;
7164
/**Storage that needs to be informed if client ended the connection.*/
@@ -76,8 +69,7 @@ class OLinkRemote : public ISocketUser
7669
* may serve several services associated with this node by the unique objectId given in link message.
7770
*/
7871
std::shared_ptr<ApiGear::ObjectLink::RemoteNode> m_node;
79-
/**A global registry to which network endpoints are added for olink objects. */
80-
ApiGear::ObjectLink::RemoteRegistry& m_registry;
72+
8173
/** Logger*/
8274
ApiGear::ObjectLink::ConsoleLogger m_log;
8375
};

templates/apigear/olink/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if(NOT objectlink-core-cpp_FOUND)
1313
message(STATUS "objectlink-core-cpp NOT FOUND, fetching the git repository")
1414
FetchContent_Declare(olink-core
1515
GIT_REPOSITORY https://github.com/apigear-io/objectlink-core-cpp.git
16-
GIT_TAG v0.2.1
16+
GIT_TAG v0.2.4
1717
GIT_SHALLOW TRUE
1818
EXCLUDE_FROM_ALL FALSE
1919
)

templates/apigear/olink/private/olinkremote.cpp

+1-13
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ namespace PocoImpl {
1616
OLinkRemote::OLinkRemote(std::unique_ptr<Poco::Net::WebSocket> socket, IConnectionStorage& connectionStorage, ApiGear::ObjectLink::RemoteRegistry& registry)
1717
: m_socket(*this),
1818
m_connectionStorage(connectionStorage),
19-
m_node(ApiGear::ObjectLink::RemoteNode::createRemoteNode(registry)),
20-
m_registry(registry)
19+
m_node(ApiGear::ObjectLink::RemoteNode::createRemoteNode(registry))
2120
{
2221
m_node->onLog(m_log.logFunc());
2322
m_node->onWrite([this](std::string msg) {
@@ -28,7 +27,6 @@ OLinkRemote::OLinkRemote(std::unique_ptr<Poco::Net::WebSocket> socket, IConnecti
2827

2928
OLinkRemote::~OLinkRemote()
3029
{
31-
removeNodeFromRegistryIfNotUnlikend();
3230
if(!m_socket.isClosed())
3331
{
3432
m_socket.close();
@@ -46,7 +44,6 @@ void OLinkRemote::handleTextMessage(const std::string& msg)
4644

4745
void OLinkRemote::onConnectionClosedFromNetwork()
4846
{
49-
removeNodeFromRegistryIfNotUnlikend();
5047
m_connectionStorage.notifyConnectionClosed();
5148
}
5249

@@ -55,13 +52,4 @@ bool OLinkRemote::isClosed() const
5552
return m_socket.isClosed();
5653
}
5754

58-
void OLinkRemote::removeNodeFromRegistryIfNotUnlikend()
59-
{
60-
auto objectsUsingNode = m_registry.getObjectIds(m_node);
61-
for (auto objectId : objectsUsingNode)
62-
{
63-
m_registry.removeNodeFromSource(m_node, objectId);
64-
}
65-
}
66-
6755
}} //namespace ApiGear::PocoImpl

templates/apigear/olink/private/olinkremote.h

+1-9
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,6 @@ class OLinkRemote : public ISocketUser
5959
*/
6060
void onConnectionClosedFromNetwork() override;
6161
private:
62-
63-
/**
64-
* Call this function when closing connection.
65-
* Removes the node from registry, for objects which didn't got the unlink message for this connection.
66-
*/
67-
void removeNodeFromRegistryIfNotUnlikend();
68-
6962
/**A socket used for this connection.*/
7063
SocketWrapper m_socket;
7164
/**Storage that needs to be informed if client ended the connection.*/
@@ -76,8 +69,7 @@ class OLinkRemote : public ISocketUser
7669
* may serve several services associated with this node by the unique objectId given in link message.
7770
*/
7871
std::shared_ptr<ApiGear::ObjectLink::RemoteNode> m_node;
79-
/**A global registry to which network endpoints are added for olink objects. */
80-
ApiGear::ObjectLink::RemoteRegistry& m_registry;
72+
8173
/** Logger*/
8274
ApiGear::ObjectLink::ConsoleLogger m_log;
8375
};

0 commit comments

Comments
 (0)