You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now require/link Boost::url when using Boost 1.81+; fallback logic keeps compatibility with older Boost versions.
Harden ETP session code: avoid holding locks while doing work, add sleeps in busy-wait loops to prevent spin, early-return on resolver errors.
fesapi_log("Cannot send Message id :", std::to_string(std::get<0>(front)->messageHeader.messageId), "because the previous message has not finished to be sent.");
137
+
fesapi_log("Cannot send Message id :", std::to_string(std::get<0>(front)->messageHeader.messageId), " because the previous message has not finished to be sent.");
138
+
return;
139
+
}
140
+
fesapi_log("Sending Message id :", std::to_string(std::get<0>(front)->messageHeader.messageId));
141
+
142
+
auto avroBytes = std::get<0>(front)->encodeHeaderAndBody();
143
+
if (avroBytes->size() >= maxWebSocketMessagePayloadSize) {
144
+
throwstd::invalid_argument("You cannot send a message which is too big. Please use message part or chunk or whatever else.");
136
145
}
137
-
else {
138
-
fesapi_log("Sending Message id :", std::to_string(std::get<0>(front)->messageHeader.messageId));
139
-
140
-
auto avroBytes = std::get<0>(front)->encodeHeaderAndBody();
141
-
142
-
//asio::buffer is a non-owning view. We must keep the underlying storage alive until the I/O completes.
143
-
if (avroBytes->size() < maxWebSocketMessagePayloadSize) {
send(ETP_NS::EtpHelpers::buildSingleMessageProtocolException(19, "The agent is unable to de-serialize the body of the message id " + std::to_string(receivedMh.messageId) + " : " + std::string(e.what())), 0, 0x02);
175
154
}
176
155
177
-
if (specificProtocolHandlers.empty() && isCloseRequested_)
auto it = protocolHandlers.find(static_cast<std::underlying_type<Energistics::Etp::v12::Datatypes::Protocol>::type>(Energistics::Etp::v12::Datatypes::Protocol::Core));
Copy file name to clipboardExpand all lines: src/fetpapi/etp/ClientSession.h
+13-11Lines changed: 13 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -64,23 +64,25 @@ namespace ETP_NS
64
64
// Run will return only when there will no more be any uncomplete operations (such as a reading operation for example)
65
65
getIoContext().run();
66
66
67
-
// Try to reconnect up to 10 times
68
-
if (!isCloseRequested_ && reconnectionTryCount_ < 10) {
69
-
++reconnectionTryCount_;
70
-
std::cerr << "Session " << getIdentifier() << " has been disconnected, trying to reconnect... " << reconnectionTryCount_ << "/10" << std::endl;
71
-
getIoContext().restart();
72
-
run();
73
-
}
74
-
75
-
if (!isCloseRequested_ && reconnectionTryCount_ >= 10) {
76
-
std::cerr << "Could not reconnect after 10 retries... Give up and close" << reconnectionTryCount_ << "/10" << std::endl;
77
-
isCloseRequested_ = true;
67
+
if (!isCloseRequested_) {
68
+
// Try to reconnect up to 10 times
69
+
if (reconnectionTryCount_ < maxReconnectionTryCount_) {
70
+
++reconnectionTryCount_;
71
+
std::cerr << "Session " << getIdentifier() << " has been disconnected, trying to reconnect... " << reconnectionTryCount_ << "/" << maxReconnectionTryCount_ << std::endl;
72
+
getIoContext().restart();
73
+
run();
74
+
}
75
+
else {
76
+
std::cerr << "Could not reconnect after " << maxReconnectionTryCount_ << " retries... Give up and close" << reconnectionTryCount_ << "/" << maxReconnectionTryCount_ << std::endl;
0 commit comments