14 Commits

Author SHA1 Message Date
Julian Strobl
186cab3356
refactor(mqtt): defer unlock where applicable (#477)
also directly return values instead of assigning them first.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-11-18 10:44:52 +01:00
Jürgen Eckel
ae086b9b37
using the defined function (#476)
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-11-18 10:26:19 +01:00
Julian Strobl
b48432f541
refactor: reduce cognitive complexity (#475)
Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-11-18 10:14:11 +01:00
Julian Strobl
61adbc0a5d
feat(mqtt): start monitor after api server (#472)
* refactor(mqtt): load end of app.new
* feat(mqtt): switch to proper logging instance
* refactor(mqtt): dry
* refactor(mqtt): do not start log message with uppercase

closes #435

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2024-11-15 11:27:17 +01:00
Lorenz Herzberger
0b17e93e9c
fix: remove error from valid check (#456) 2024-10-15 12:56:00 +02:00
Lorenz Herzberger
2a5b7c49c8
447 add validatoraddress getter to config (#449)
* feat: add GetValidatorAddress() to config
* feat: add GetDefaultValidatorRecord() to libConfig
---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2024-10-02 13:52:26 +02:00
Lorenz Herzberger
975a1005b0
test: add additonal validatorPopReward reallocation test (#436)
* test: add additonal validatorPopReward reallocation test
* fix: linter & staticcheck errors
---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2024-09-10 09:13:20 +02:00
Lorenz Herzberger
c2ef2b5924
feat: add QueryActiveTrustAnchorCount (#431)
* feat: add QueryActiveTrustAnchorCount
---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2024-07-24 09:44:07 +02:00
Jürgen Eckel
1462b6ee88
add only legit machine addresses to the PoPSelection process (#404)
add only legit machine addresses to the PoPSelection process

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-06-06 14:37:09 +02:00
Jürgen Eckel
e99b614e4a
added connection loss handler, extended logging, mqtt msg updates (#400)
* added a bit of logging
* added update messages to mqtt (every second with a timestamp)
* added isConnectionOpen to the interface and analysis this during execution
* added connection loss handler and status check
* put some global objects into an objects to avoid inter service testing issues
* TestingLocker Mutex to RWMutex (increase performance)
* termintationMutex became a sync.RWMutex
* added logging to the mqtt mock client
* made monitor Mutex a RWMutex
* added Mutex protection to the numberOfElements varialbe
* added another Waiting block to the machine attestation methods (CI tests)
* had to adjust the test cases to the impact of that change.

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-05-16 17:06:19 +02:00
Jürgen Eckel
0c05081604
unlock mutex before return (#399)
* unlock mutex before return
* added termination clause for the scheduler



Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-05-15 17:05:26 +02:00
Jürgen Eckel
1f2b1702ea
Eckelj/mqtt monitoring fix (#398)
* set keepalive ping
* made mutex more granular
* avoid using app.Logger to have a consistent log from the beginning
* made lazyLoading local to the module
* fixed ticker bug so that the tasks are executed in an endless loop
* fixed timezone bug of Add Participant. only validator local time is used not the timestamp from the mqtt messages as these might come from a different time zone (resulted in delayed deletion from the activeActors DB)
* improved connection management for the monitor
* added a watchdog task to restart the monitor in case of connection loss (every 2 min)
* removed obsolete SetContext function/interface
* removed obsolete time conversion method

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-05-15 13:23:06 +02:00
Jürgen Eckel
b45c381b3b
TLS support for planetmint (#381)
* added TSL support for mqtt
* added configuration value mqtt-tls (bool) to support tls and non-tls connections (testing)


Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-04-24 14:59:17 +02:00
Jürgen Eckel
779b1edd48
Eckelj/mqtt monitoring (#359)
* added a MqttMonitor module with levelDB and periodic cleanup
* initialized in the app
* passed to dao keeper
* added conversion methods (string2unixtime, byte ToJSON)
* removed obsolete keeper code
* maded  RDDLToken.Factor public
* added explicit mqtt client to the monitor module
* restart mqtt connection in mqttmonitor on connection loss
* adjusted mqttmock structure to be compatible
* added some linter exclusions to let the monitor tool pass
* created a MockMqttMonitor interface and mock object
* used this to pass tests
* made the MockMqttMonitor a global object so that it can be easily mocked
* removed MockMqttMonitor from the app/keeper initialization
* adjusted test cases to register "active machines" to the mqttmonitor
* added mutex in mocks to protect against data races
* defined mocks for the dao tests
* clear separation between interface and mqtt-Monitor

* added another waiting block to ensure the tx went through (multi-threading issue, race condition) during tests this failed sometimes
* added memstorage to test instead of a file based DB


Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-04-08 10:49:00 +02:00