diff --git a/common/cpp/src/http_client/curl_http_client.cpp b/common/cpp/src/http_client/curl_http_client.cpp index d104b3f062803decc9ac7203bacdab8624afeb3a..6111559f39b5dbe1ba4e17881c05bb2ffb5887f5 100644 --- a/common/cpp/src/http_client/curl_http_client.cpp +++ b/common/cpp/src/http_client/curl_http_client.cpp @@ -108,7 +108,6 @@ CurlHttpClient::~CurlHttpClient() { if (curl_) { curl_easy_cleanup(curl_); } - } diff --git a/common/cpp/src/system_io/system_io_linux.cpp b/common/cpp/src/system_io/system_io_linux.cpp index be6393f3f1a7e5d0c6af9dfc6d3ff283833965b5..e2782d35d72d55f304ea172e3b79f7a95a0a8933 100644 --- a/common/cpp/src/system_io/system_io_linux.cpp +++ b/common/cpp/src/system_io/system_io_linux.cpp @@ -202,7 +202,7 @@ void SystemIO::CollectFileInformationRecursively(const std::string& path, void SystemIO::ApplyNetworkOptions(SocketDescriptor socket_fd, Error* err) const { //TODO: Need to change network layer code, so everything can be NonBlocking - int flag; + int flag = 1; if ( /*(flags = fcntl(socket_fd, F_GETFL, 0)) == -1 || diff --git a/receiver/src/receiver_statistics.h b/receiver/src/receiver_statistics.h index 83be94197d50e828b080bb8440af993da36a9b2f..877eb5453393c862c9b9b394bdd108356a3425ac 100644 --- a/receiver/src/receiver_statistics.h +++ b/receiver/src/receiver_statistics.h @@ -10,7 +10,6 @@ enum StatisticEntity : int { kDatabase = 0, kDisk, kNetwork, - kAuthorizer }; static const std::vector<std::string> kStatisticEntityNames = {"db_share", "disk_share", "network_share"}; diff --git a/receiver/src/request_handler_authorize.cpp b/receiver/src/request_handler_authorize.cpp index b7ff5d211e6dacff19b38423bf4b5bb29bd86ffe..d0662d6b80c1cdc3b7638886044a951e12803d8b 100644 --- a/receiver/src/request_handler_authorize.cpp +++ b/receiver/src/request_handler_authorize.cpp @@ -100,7 +100,7 @@ RequestHandlerAuthorize::RequestHandlerAuthorize(): log__{GetDefaultReceiverLogg } StatisticEntity RequestHandlerAuthorize::GetStatisticEntity() const { - return StatisticEntity::kAuthorizer; + return StatisticEntity::kNetwork; } diff --git a/receiver/src/requests_dispatcher.cpp b/receiver/src/requests_dispatcher.cpp index 8186be412f6a0af38f58a5983c3322234f39015e..c50319f847b4efe9d13055fa2affd4b44f7304e4 100644 --- a/receiver/src/requests_dispatcher.cpp +++ b/receiver/src/requests_dispatcher.cpp @@ -32,6 +32,7 @@ Error RequestsDispatcher::ProcessRequest(const std::unique_ptr<Request>& request Error handle_err; handle_err = request->Handle(statistics__); GenericNetworkResponse generic_response; + generic_response.op_code = request->GetOpCode(); generic_response.error_code = GetNetworkCodeFromError(handle_err); strcpy(generic_response.message, ""); if (handle_err) { diff --git a/receiver/src/statistics.cpp b/receiver/src/statistics.cpp index d35773cf14a7698a50aefe5c3091ea676f751176..eac194d0441161e194bcd7adb77ff07c941261d1 100644 --- a/receiver/src/statistics.cpp +++ b/receiver/src/statistics.cpp @@ -55,7 +55,7 @@ void Statistics::IncreaseRequestCounter() noexcept { Statistics::Statistics(unsigned int write_frequency) : write_interval_{write_frequency} { - statistics_sender_list__.emplace_back(new StatisticsSenderInfluxDb); + statistics_sender_list__.emplace_back(std::unique_ptr<StatisticsSender> {new StatisticsSenderInfluxDb}); // statistics_sender_list__.emplace_back(new StatisticsSenderFluentd); ResetStatistics(); } diff --git a/receiver/src/statistics.h b/receiver/src/statistics.h index 791d296a1d1c852c3fabb0ee830beb66cf491c64..05a2c6878e1633f02e2ca1304866e9508701326b 100644 --- a/receiver/src/statistics.h +++ b/receiver/src/statistics.h @@ -33,6 +33,7 @@ class Statistics { VIRTUAL void AddTag(const std::string& name, const std::string& value) noexcept; void SetWriteInterval(uint64_t interval_ms); std::vector<std::unique_ptr<StatisticsSender>> statistics_sender_list__; + virtual ~Statistics() = default; protected: static const unsigned int kDefaultStatisticWriteIntervalMs = 10000; virtual StatisticsToSend PrepareStatisticsToSend() const noexcept; diff --git a/receiver/src/statistics_sender_influx_db.h b/receiver/src/statistics_sender_influx_db.h index 909dadd56f1095c633997c696584b8973da9677f..65c1a579d5e0f65e29c3135f491c09bed85fa9dc 100644 --- a/receiver/src/statistics_sender_influx_db.h +++ b/receiver/src/statistics_sender_influx_db.h @@ -13,6 +13,9 @@ class StatisticsSenderInfluxDb : public StatisticsSender { virtual void SendStatistics(const StatisticsToSend& statistic) const noexcept override; std::unique_ptr<HttpClient> httpclient__; const AbstractLogger* log__; + ~StatisticsSenderInfluxDb() { + printf("Deleting StatisticsSenderInfluxDb\n"); + }; private: std::string StatisticsToString(const StatisticsToSend& statistic) const noexcept; diff --git a/receiver/unittests/test_request_handler_authorizer.cpp b/receiver/unittests/test_request_handler_authorizer.cpp index 75ada9ccd5033eb60f222284c5d21c8c87c91107..8e179fa71f49e781d125b0c8a5821a5c97f1322c 100644 --- a/receiver/unittests/test_request_handler_authorizer.cpp +++ b/receiver/unittests/test_request_handler_authorizer.cpp @@ -148,7 +148,7 @@ class AuthorizerHandlerTests : public Test { TEST_F(AuthorizerHandlerTests, CheckStatisticEntity) { auto entity = handler.GetStatisticEntity(); - ASSERT_THAT(entity, Eq(asapo::StatisticEntity::kAuthorizer)); + ASSERT_THAT(entity, Eq(asapo::StatisticEntity::kNetwork)); } TEST_F(AuthorizerHandlerTests, ErrorNotAuthorizedYet) { diff --git a/tests/automatic/producer_receiver/transfer_single_file/check_linux.sh b/tests/automatic/producer_receiver/transfer_single_file/check_linux.sh index cb98e506772d1c350cec3ae422d9ecd1c2a11139..a24e10a64463306acf76e19fbb8a9b8933b9e4bc 100644 --- a/tests/automatic/producer_receiver/transfer_single_file/check_linux.sh +++ b/tests/automatic/producer_receiver/transfer_single_file/check_linux.sh @@ -36,5 +36,4 @@ $1 localhost:8400 ${beamtime_id} 100 1 1 0 30 ls -ln ${receiver_folder}/1 | awk '{ print $5 }'| grep 100000 - -$1 localhost:8400 wrong_beamtime_id 100 1 1 0 1 2>1 | grep "authorization failed" +$1 localhost:8400 wrong_beamtime_id 100 1 1 0 1 2>&1 | tee /dev/stderr | grep "authorization failed"