Skip to content

Commit

Permalink
Anjay 3.2.1
Browse files Browse the repository at this point in the history
Improvements
- Added some missing log messages for potential scheduler errors
- Updated the version of pybind11 used by integration tests to 2.10.1

Bugfixes
- Fixed a regression in 3.2.0 that caused some invalid Writes to be silently ignored without responding with proper error codes
- Fixed compatibility of integration tests with Python 3.11 and the current Github macOS environment
  • Loading branch information
Mateusz Kwiatkowski authored and Kucmasz committed Dec 13, 2022
1 parent 41c7aef commit 6bfb0b4
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 32 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/anjay-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,14 @@ jobs:
- run: brew update && brew upgrade
# NOTE: latest known compatible versions are openssl@3--3.0.5 and mbedtls--3.2.1
- run: brew install openssl mbedtls $COMPILER_VERSION
- run: pip3 install sphinx sphinx-rtd-theme cbor2 aiocoap cryptography packaging requests
- run: pip3 install sphinx sphinx-rtd-theme cbor2 aiocoap cryptography packaging requests wheel
- run: env JAVA_HOME="$JAVA_HOME_17_X64" ./devconfig --with-asan --without-analysis --no-examples -DWITH_VALGRIND_TRACK_ORIGINS=OFF -DWITH_URL_CHECK=OFF
- run: LC_ALL=C.UTF-8 make -j
- run: LC_ALL=C.UTF-8 make check
strategy:
fail-fast: false
matrix:
include:
- CC: gcc-11
CXX: g++-11
COMPILER_VERSION: gcc@11
- CC: gcc-12
CXX: g++-12
COMPILER_VERSION: gcc@12
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 3.2.1 (December 13th, 2022)

### Improvements

- Added some missing log messages for potential scheduler errors
- Updated the version of pybind11 used by integration tests to 2.10.1

### Bugfixes

- Fixed a regression in 3.2.0 that caused some invalid Writes to be silently ignored without responding with proper error codes
- Fixed compatibility of integration tests with Python 3.11 and the current Github macOS environment

## 3.2.0 (December 7th, 2022)

### BREAKING CHANGES
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
cmake_minimum_required(VERSION 3.6.0)

project(anjay C)
set(ANJAY_VERSION "3.2.0" CACHE STRING "Anjay library version")
set(ANJAY_VERSION "3.2.1" CACHE STRING "Anjay library version")
set(ANJAY_BINARY_VERSION 1.0.0)

set(ANJAY_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
Expand Down
16 changes: 10 additions & 6 deletions demo/demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,12 @@ static void reschedule_notify_time_dependent(anjay_demo_t *demo) {
.nanoseconds = 0
}
};
AVS_SCHED_DELAYED(anjay_get_scheduler(demo->anjay),
&demo->notify_time_dependent_job,
avs_time_real_diff(next_full_second, now),
notify_time_dependent_job, &demo, sizeof(demo));
if (AVS_SCHED_DELAYED(anjay_get_scheduler(demo->anjay),
&demo->notify_time_dependent_job,
avs_time_real_diff(next_full_second, now),
notify_time_dependent_job, &demo, sizeof(demo))) {
demo_log(ERROR, "Could not reschedule notify_time_dependent_job");
}
}

static int demo_init(anjay_demo_t *demo, cmdline_args_t *cmdline_args) {
Expand Down Expand Up @@ -865,8 +867,10 @@ int main(int argc, char *argv[]) {
// called before the event loop actually starts; it means that we
// can't call it directly here, as it would lead to a race condition
// if stdin is closed immediately (e.g. is /dev/null).
AVS_SCHED_NOW(anjay_get_scheduler(demo->anjay), NULL,
interrupt_event_loop_job, &demo, sizeof(demo));
if (AVS_SCHED_NOW(anjay_get_scheduler(demo->anjay), NULL,
interrupt_event_loop_job, &demo, sizeof(demo))) {
demo_log(ERROR, "Could not schedule interrupt_event_loop_job");
}
}

pthread_join(event_loop_thread, NULL);
Expand Down
10 changes: 6 additions & 4 deletions demo/demo_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1544,8 +1544,10 @@ static void handle_command(avs_sched_t *sched, const void *invocation_) {
}

void demo_command_dispatch(const demo_command_invocation_t *invocation) {
AVS_SCHED_NOW(anjay_get_scheduler(invocation->demo->anjay), NULL,
handle_command, invocation,
offsetof(demo_command_invocation_t, cmd)
+ strlen(invocation->cmd) + 1);
if (AVS_SCHED_NOW(anjay_get_scheduler(invocation->demo->anjay), NULL,
handle_command, invocation,
offsetof(demo_command_invocation_t, cmd)
+ strlen(invocation->cmd) + 1)) {
demo_log(ERROR, "Could not schedule handle_command");
}
}
2 changes: 1 addition & 1 deletion doc/sphinx/snippet_sources.md5
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
07ebc8ace123f26e27ea86dc60f6f08a demo/demo_cmds.c
2682a694f828ae18d5c84d09f08b2bc9 demo/demo_cmds.c
d40d273d5238821ff98b114ed81d4497 demo/objects/ipso_objects.c
6b207ab1e0b2a2305a41041cf7ff73fe deps/avs_coap/include_public/avsystem/coap/tcp.h
b693d5bc29ed86d80597057499cb9663 deps/avs_coap/include_public/avsystem/coap/udp.h
Expand Down
13 changes: 7 additions & 6 deletions src/core/anjay_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
VISIBILITY_SOURCE_BEGIN

#ifndef ANJAY_VERSION
# define ANJAY_VERSION "3.2.0"
# define ANJAY_VERSION "3.2.1"
#endif // ANJAY_VERSION

#ifdef ANJAY_WITH_LWM2M11
Expand Down Expand Up @@ -270,11 +270,12 @@ void _anjay_reschedule_coap_sched_job(anjay_unlocked_t *anjay) {
avs_time_monotonic_t next_job_time =
avs_sched_time_of_next(anjay->coap_sched);
if (avs_time_monotonic_valid(next_job_time)) {
if (!anjay->coap_sched_job_handle
|| AVS_RESCHED_AT(&anjay->coap_sched_job_handle,
next_job_time)) {
AVS_SCHED_AT(anjay->sched, &anjay->coap_sched_job_handle,
next_job_time, coap_sched_job, NULL, 0);
if ((!anjay->coap_sched_job_handle
|| AVS_RESCHED_AT(&anjay->coap_sched_job_handle,
next_job_time))
&& AVS_SCHED_AT(anjay->sched, &anjay->coap_sched_job_handle,
next_job_time, coap_sched_job, NULL, 0)) {
anjay_log(ERROR, _("Could not reschedule coap_sched_job"));
}
} else {
avs_sched_del(&anjay->coap_sched_job_handle);
Expand Down
23 changes: 14 additions & 9 deletions src/core/dm/anjay_dm_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,19 +309,24 @@ write_instance_and_move_to_next_entry(anjay_unlocked_t *anjay,
return ANJAY_ERR_BAD_REQUEST;
}
anjay_dm_resource_kind_t kind;
if (_anjay_uri_path_has(&path, ANJAY_ID_RID)
&& !preverify_resource_before_writing(anjay, obj, NULL, &path,
false, &kind, NULL)) {
if (!_anjay_uri_path_has(&path, ANJAY_ID_RID)) {
return _anjay_input_next_entry(in_ctx);
}
bool next_entry_called = false;
if (!(result = preverify_resource_before_writing(
anjay, obj, NULL, &path, false, &kind, NULL))) {
result = write_resource_and_move_to_next_entry(anjay, obj, &path,
kind, is_array,
in_ctx, notify_queue,
write_type);
if (result == ANJAY_ERR_NOT_FOUND
|| result == ANJAY_ERR_NOT_IMPLEMENTED) {
result = 0;
}
} else {
result = _anjay_input_next_entry(in_ctx);
next_entry_called = true;
}
if (result == ANJAY_ERR_NOT_FOUND
|| result == ANJAY_ERR_NOT_IMPLEMENTED) {
result = 0;
}
if (!next_entry_called) {
result = return_with_moving_to_next_entry(in_ctx, result);
}
} while (!result);
return result;
Expand Down
Submodule pybind11 updated 240 files
7 changes: 7 additions & 0 deletions tests/integration/suites/default/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ def runTest(self):
])


class TlvInstanceWriteMethodNotAllowedTest(FormatTest.Test):
def runTest(self):
self.write_instance(self.serv, OID.Server, 1,
TLV.make_resource(RID.Server.ShortServerID, 42).serialize(),
partial=True, expect_error_code=coap.Code.RES_METHOD_NOT_ALLOWED)


class UnsupportedFormatWritesTest(FormatTest.Test):
def runTest(self):
for rid in (RID.Test.ResInt,
Expand Down

0 comments on commit 6bfb0b4

Please sign in to comment.