Skip to content

Commit 519388e

Browse files
authored
Support changes in req-resp operations (awslabs#651)
1 parent 1e20a12 commit 519388e

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

source/mqtt_request_response.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,7 @@ static void s_aws_mqtt_make_request_binding_destroy(struct aws_mqtt_make_request
352352
}
353353

354354
static void s_on_mqtt_request_complete(
355-
const struct aws_byte_cursor *response_topic,
356-
const struct aws_byte_cursor *payload,
355+
const struct aws_mqtt_rr_incoming_publish_event *publish_event,
357356
int error_code,
358357
void *user_data) {
359358

@@ -368,10 +367,10 @@ static void s_on_mqtt_request_complete(
368367
request_binding->on_request_complete_callback,
369368
"(is#y#)",
370369
/* i */ error_code,
371-
/* s */ response_topic ? response_topic->ptr : NULL,
372-
/* # */ response_topic ? response_topic->len : 0,
373-
/* y */ payload ? payload->ptr : NULL,
374-
/* # */ payload ? payload->len : 0);
370+
/* s */ publish_event ? publish_event->topic.ptr : NULL,
371+
/* # */ publish_event ? publish_event->topic.len : 0,
372+
/* y */ publish_event ? publish_event->payload.ptr : NULL,
373+
/* # */ publish_event ? publish_event->payload.len : 0);
375374
if (!result) {
376375
PyErr_WriteUnraisable(PyErr_Occurred());
377376
}
@@ -467,7 +466,7 @@ PyObject *aws_py_mqtt_request_response_client_make_request(PyObject *self, PyObj
467466
};
468467

469468
if (aws_mqtt_request_response_client_submit_request(client_binding->native, &request_options)) {
470-
s_on_mqtt_request_complete(NULL, NULL, aws_last_error(), request_binding);
469+
s_on_mqtt_request_complete(NULL, aws_last_error(), request_binding);
471470
}
472471
}
473472

@@ -551,10 +550,11 @@ static void s_aws_mqtt_streaming_operation_subscription_status_callback_python(
551550
}
552551

553552
static void s_aws_mqtt_streaming_operation_incoming_publish_callback_python(
554-
struct aws_byte_cursor payload,
555-
struct aws_byte_cursor topic,
553+
const struct aws_mqtt_rr_incoming_publish_event *publish_event,
556554
void *user_data) {
557555

556+
AWS_FATAL_ASSERT(publish_event != NULL);
557+
558558
struct mqtt_streaming_operation_binding *stream_binding = user_data;
559559

560560
PyGILState_STATE state;
@@ -565,10 +565,10 @@ static void s_aws_mqtt_streaming_operation_incoming_publish_callback_python(
565565
PyObject *result = PyObject_CallFunction(
566566
stream_binding->incoming_publish_callable,
567567
"(s#y#)",
568-
/* s */ topic.ptr,
569-
/* # */ topic.len,
570-
/* y */ payload.ptr,
571-
/* # */ payload.len);
568+
/* s */ publish_event->topic.ptr,
569+
/* # */ publish_event->topic.len,
570+
/* y */ publish_event->payload.ptr,
571+
/* # */ publish_event->payload.len);
572572
if (!result) {
573573
PyErr_WriteUnraisable(PyErr_Occurred());
574574
}
@@ -673,4 +673,4 @@ struct aws_mqtt_rr_client_operation *aws_py_get_mqtt_streaming_operation(PyObjec
673673
s_capsule_name_mqtt_streaming_operation,
674674
"StreamingOperation",
675675
mqtt_streaming_operation_binding);
676-
}
676+
}

0 commit comments

Comments
 (0)