Skip to content

Commit

Permalink
log listener init and invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
gammelby committed Dec 2, 2024
1 parent 592b737 commit 408b200
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/api/nabto_device_coap.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

np_error_code nabto_device_coap_listener_callback(const np_error_code ec, struct nabto_device_future* future, void* eventData, void* listenerData);

void print_path(const char** path);

/*******************************************
* COAP API Start
*******************************************/
Expand All @@ -27,6 +29,9 @@ nabto_device_coap_init_listener(NabtoDevice* device, NabtoDeviceListener* device
return NABTO_DEVICE_EC_OUT_OF_MEMORY;
}

printf("VBOX_DEBUG: nabto_device_coap_init_listener, listener=%p\n", deviceListener);
print_path(pathSegments);

res->dev = dev;
np_error_code ec = NABTO_EC_OK;
nabto_device_threads_mutex_lock(dev->eventMutex);
Expand Down Expand Up @@ -252,6 +257,8 @@ void nabto_device_coap_resource_handler(struct nc_coap_server_request* request,
req->connectionRef = nc_coap_server_request_get_connection_ref(request);

np_error_code ec = nabto_device_listener_add_event(resource->listener, &req->eventListNode, req);
printf("VBOX_DEBUG: invoking listener, listener=%p\n", resource->listener);

if (ec != NABTO_EC_OK) {
// since we are out of resources, this probably fails. Either way we keep cleaning up
nc_coap_server_send_error_response(request, (nabto_coap_code)(NABTO_COAP_CODE(5,00)), "Insufficient resources");
Expand Down

0 comments on commit 408b200

Please sign in to comment.