Skip to content

Commit

Permalink
update submodules to latest pre-release (#170)
Browse files Browse the repository at this point in the history
update submodules to latest pre-release

Co-authored-by: Dengke Tang <[email protected]>
  • Loading branch information
TingDaoK and TingDaoK authored Aug 4, 2020
1 parent 9148622 commit 5f6be49
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion aws-common-runtime/aws-c-common
Submodule aws-c-common updated 1011 files
6 changes: 1 addition & 5 deletions source/mqtt_client_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1096,12 +1096,8 @@ PyObject *aws_py_mqtt_client_connection_resubscribe_existing_topics(PyObject *se
/* C will not be invoking the python callback */
Py_DECREF(suback_callback);

/* Don't raise a Python exception if error is AWS_ERROR_MQTT_NO_TOPICS_FOR_RESUBSCRIBE.
* This is a harmless error, we'll just return None instead of a msg_id */
int aws_err = aws_last_error();
if (aws_err == AWS_ERROR_MQTT_NO_TOPICS_FOR_RESUBSCRIBE) {
Py_RETURN_NONE;
} else {
if (aws_err) {
PyErr_SetAwsLastError();
return NULL;
}
Expand Down
17 changes: 16 additions & 1 deletion test/test_mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,29 @@ def on_message(**kwargs):
connection.disconnect().result(TIMEOUT)

def test_on_message(self):
connection = self._test_connection()
config = Config.get()
elg = EventLoopGroup()
resolver = DefaultHostResolver(elg)
bootstrap = ClientBootstrap(elg, resolver)

tls_opts = TlsContextOptions.create_client_with_mtls(config.cert, config.key)
tls = ClientTlsContext(tls_opts)

client = Client(bootstrap, tls)
connection = Connection(
client=client,
client_id=create_client_id(),
host_name=config.endpoint,
port=8883)
received = Future()

def on_message(**kwargs):
received.set_result(kwargs)

# on_message for connection has to be set before connect, or possible race will happen
connection.on_message(on_message)

connection.connect().result(TIMEOUT)
# subscribe without callback
subscribed, packet_id = connection.subscribe(self.TEST_TOPIC, QoS.AT_LEAST_ONCE)
subscribed.result(TIMEOUT)
Expand Down

0 comments on commit 5f6be49

Please sign in to comment.