Skip to content

Commit 5f6be49

Browse files
authored
update submodules to latest pre-release (#170)
update submodules to latest pre-release Co-authored-by: Dengke Tang <dengket@amazon.com>
1 parent 9148622 commit 5f6be49

File tree

7 files changed

+22
-11
lines changed

7 files changed

+22
-11
lines changed

aws-common-runtime/aws-c-common

Submodule aws-c-common updated 1011 files

source/mqtt_client_connection.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,12 +1096,8 @@ PyObject *aws_py_mqtt_client_connection_resubscribe_existing_topics(PyObject *se
10961096
/* C will not be invoking the python callback */
10971097
Py_DECREF(suback_callback);
10981098

1099-
/* Don't raise a Python exception if error is AWS_ERROR_MQTT_NO_TOPICS_FOR_RESUBSCRIBE.
1100-
* This is a harmless error, we'll just return None instead of a msg_id */
11011099
int aws_err = aws_last_error();
1102-
if (aws_err == AWS_ERROR_MQTT_NO_TOPICS_FOR_RESUBSCRIBE) {
1103-
Py_RETURN_NONE;
1104-
} else {
1100+
if (aws_err) {
11051101
PyErr_SetAwsLastError();
11061102
return NULL;
11071103
}

test/test_mqtt.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,29 @@ def on_message(**kwargs):
143143
connection.disconnect().result(TIMEOUT)
144144

145145
def test_on_message(self):
146-
connection = self._test_connection()
146+
config = Config.get()
147+
elg = EventLoopGroup()
148+
resolver = DefaultHostResolver(elg)
149+
bootstrap = ClientBootstrap(elg, resolver)
150+
151+
tls_opts = TlsContextOptions.create_client_with_mtls(config.cert, config.key)
152+
tls = ClientTlsContext(tls_opts)
153+
154+
client = Client(bootstrap, tls)
155+
connection = Connection(
156+
client=client,
157+
client_id=create_client_id(),
158+
host_name=config.endpoint,
159+
port=8883)
147160
received = Future()
148161

149162
def on_message(**kwargs):
150163
received.set_result(kwargs)
151164

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

168+
connection.connect().result(TIMEOUT)
154169
# subscribe without callback
155170
subscribed, packet_id = connection.subscribe(self.TEST_TOPIC, QoS.AT_LEAST_ONCE)
156171
subscribed.result(TIMEOUT)

0 commit comments

Comments
 (0)