Skip to content

Commit

Permalink
update submodules (#259)
Browse files Browse the repository at this point in the history
- to bring the change that hold a deep copy of publish payload, thus binding don't need to keep the buffer until complete
- Proxy update
  • Loading branch information
TingDaoK authored Apr 7, 2021
1 parent c2ab683 commit a5cddf8
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion awscrt/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class Connection(NativeResource):
protocol_operation_timeout_ms (int): Milliseconds to wait for the response to the operation
requires response by protocol. Set to zero to disable timeout. Otherwise,
the operation will fail if no response is received within this amount of time after
* the packet is written to the socket
the packet is written to the socket
It applied to PUBLISH (QoS>0) and UNSUBSCRIBE now.
will (Will): Will to send with CONNECT packet. The will is
Expand Down
1 change: 1 addition & 0 deletions source/http_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <aws/common/array_list.h>
#include <aws/http/connection.h>
#include <aws/http/proxy.h>
#include <aws/http/request_response.h>
#include <aws/io/socket.h>

Expand Down
1 change: 1 addition & 0 deletions source/http_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "io.h"

#include <aws/http/connection.h>
#include <aws/http/proxy.h>

bool aws_py_http_proxy_options_init(struct aws_http_proxy_options *proxy_options, PyObject *py_proxy_options) {
AWS_ZERO_STRUCT(*proxy_options);
Expand Down
13 changes: 5 additions & 8 deletions source/mqtt_client_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <aws/mqtt/client.h>

#include <aws/http/connection.h>
#include <aws/http/proxy.h>
#include <aws/http/request_response.h>

#include <aws/io/channel.h>
Expand Down Expand Up @@ -684,8 +685,6 @@ PyObject *aws_py_mqtt_client_connection_reconnect(PyObject *self, PyObject *args
******************************************************************************/

struct publish_complete_userdata {
Py_buffer topic;
Py_buffer payload;
PyObject *callback;
};

Expand Down Expand Up @@ -714,8 +713,6 @@ static void s_publish_complete(
}

Py_DECREF(metadata->callback);
PyBuffer_Release(&metadata->topic);
PyBuffer_Release(&metadata->payload);

PyGILState_Release(state);

Expand Down Expand Up @@ -758,16 +755,14 @@ PyObject *aws_py_mqtt_client_connection_publish(PyObject *self, PyObject *args)
goto metadata_alloc_failed;
}

metadata->topic = topic_stack;
metadata->payload = payload_stack;
metadata->callback = puback_callback;
Py_INCREF(metadata->callback);

struct aws_byte_cursor topic_cursor;
topic_cursor = aws_byte_cursor_from_array(metadata->topic.buf, metadata->topic.len);
topic_cursor = aws_byte_cursor_from_array(topic_stack.buf, topic_stack.len);

struct aws_byte_cursor payload_cursor;
payload_cursor = aws_byte_cursor_from_array(metadata->payload.buf, metadata->payload.len);
payload_cursor = aws_byte_cursor_from_array(payload_stack.buf, payload_stack.len);

enum aws_mqtt_qos qos = (enum aws_mqtt_qos)qos_val;

Expand All @@ -778,6 +773,8 @@ PyObject *aws_py_mqtt_client_connection_publish(PyObject *self, PyObject *args)
PyErr_SetAwsLastError();
goto publish_failed;
}
PyBuffer_Release(&topic_stack);
PyBuffer_Release(&payload_stack);

return PyLong_FromUnsignedLong(msg_id);

Expand Down

0 comments on commit a5cddf8

Please sign in to comment.