Skip to content

Commit bd2a474

Browse files
moving threadpool (#9)
* moving threadpool * moving threadpool * Adding checks * adding a check for 0 * compilation fix
1 parent 1c640c9 commit bd2a474

9 files changed

Lines changed: 68 additions & 289 deletions

File tree

lib/include/up-client-zenoh-cpp/message/messageBuilder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@
2727

2828
#include <cstdint>
2929
#include <cstring>
30-
#include <up-cpp/tools/base64.h>
30+
#include <up-cpp/utils/base64.h>
3131
#include <up-cpp/transport/datamodel/UPayload.h>
3232
#include <up-cpp/transport/datamodel/UAttributes.h>
3333
#include <up-client-zenoh-cpp/message/messageCommon.h>
3434
#include <up-core-api/ustatus.pb.h>
3535
#include <up-core-api/uri.pb.h>
3636

3737
using namespace uprotocol::utransport;
38+
using namespace uprotocol::utils;
3839
using namespace uprotocol::v1;
3940

4041
class MessageBuilder

lib/include/up-client-zenoh-cpp/message/messageParser.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@
2828
#include <unordered_map>
2929
#include <vector>
3030
#include <up-client-zenoh-cpp/message/messageCommon.h>
31-
#include <up-cpp/tools/base64.h>
31+
#include <up-cpp/utils/base64.h>
3232
#include <up-cpp/transport/datamodel/UPayload.h>
3333
#include <up-cpp/transport/datamodel/UAttributes.h>
3434
#include <up-core-api/uri.pb.h>
3535

3636
using namespace uprotocol::utransport;
3737
using namespace uprotocol::v1;
38-
using namespace uprotocol::tools;
38+
using namespace uprotocol::utils;
39+
3940
struct TLV {
4041
Tag type;
4142
size_t length;

lib/include/up-client-zenoh-cpp/rpc/zenohRpcClient.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@
2626
#define _ZENOH_RPC_CLIENT_H_
2727

2828
#include <up-cpp/rpc/RpcClient.h>
29-
#include <up-client-zenoh-cpp/utils/ThreadPool.h>
30-
#include <zenoh.h>
29+
#include <up-cpp/utils/ThreadPool.h>
3130
#include <up-core-api/ustatus.pb.h>
3231
#include <up-core-api/uri.pb.h>
32+
#include <zenoh.h>
3333

3434
using namespace std;
3535
using namespace uprotocol::utransport;
36+
using namespace uprotocol::utils;
3637
using namespace uprotocol::v1;
3738

3839
class ZenohRpcClient : public RpcClient {
@@ -85,7 +86,8 @@ class ZenohRpcClient : public RpcClient {
8586
std::shared_ptr<ThreadPool> threadPool_;
8687

8788
static constexpr auto requestTimeoutMs_ = 5000;
88-
static constexpr auto threadPoolSize_ = size_t(10);
89+
static constexpr auto queueSize_ = size_t(20);
90+
static constexpr auto maxNumOfCuncurrentRequests_ = size_t(2);
8991

9092
};
9193

lib/include/up-client-zenoh-cpp/utils/ConcurrentCyclicQueue.h

Lines changed: 0 additions & 112 deletions
This file was deleted.

lib/include/up-client-zenoh-cpp/utils/ThreadPool.h

Lines changed: 0 additions & 121 deletions
This file was deleted.

lib/src/messageBuilder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
*/
2424

2525
#include <up-client-zenoh-cpp/message/messageBuilder.h>
26-
#include <up-cpp/tools/base64.h>
26+
#include <up-cpp/utils/base64.h>
2727
#include <up-cpp/uuid/serializer/UuidSerializer.h>
2828
#include <up-cpp/uri/serializer/LongUriSerializer.h>
2929
#include <spdlog/spdlog.h>
3030

3131
using namespace uprotocol::uri;
3232
using namespace uprotocol::uuid;
33-
using namespace uprotocol::tools;
33+
using namespace uprotocol::utils;
3434

3535
std::vector<uint8_t> MessageBuilder::buildHeader(const UAttributes &attributes) {
3636

@@ -161,7 +161,7 @@ size_t MessageBuilder::calculateSize(const UAttributes &attributes) noexcept {
161161
}
162162

163163
if (attributes.sink().has_value()) {
164-
updateSize(uprotocol::tools::Base64::encode(LongUriSerializer::serialize(attributes.sink().value())), msgSize);
164+
updateSize(Base64::encode(LongUriSerializer::serialize(attributes.sink().value())), msgSize);
165165
}
166166

167167
if (attributes.plevel().has_value()) {

lib/src/messageParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424

2525
#include <up-client-zenoh-cpp/message/messageParser.h>
26-
#include <up-cpp/tools/base64.h>
26+
#include <up-cpp/utils/base64.h>
2727
#include <up-cpp/transport/datamodel/UPayload.h>
2828
#include <up-cpp/transport/datamodel/UAttributes.h>
2929
#include <up-cpp/uri/serializer/LongUriSerializer.h>
@@ -34,7 +34,7 @@
3434
using namespace uprotocol::utransport;
3535
using namespace uprotocol::v1;
3636
using namespace uprotocol::uuid;
37-
using namespace uprotocol::tools;
37+
using namespace uprotocol::utils;
3838

3939
std::optional<std::unordered_map<Tag,TLV>> MessageParser::getAllTlv(const uint8_t *data,
4040
size_t size) noexcept {

0 commit comments

Comments
 (0)