Skip to content

Commit

Permalink
new changes
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Sep 19, 2024
1 parent f4f6ea2 commit d19acc8
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 22 deletions.
2 changes: 1 addition & 1 deletion crt/aws-c-cal
2 changes: 1 addition & 1 deletion crt/aws-c-mqtt
Submodule aws-c-mqtt updated 45 files
+12 −3 .github/workflows/ci.yml
+4 −6 .github/workflows/clang-format.yml
+2 −0 CMakeLists.txt
+29 −0 bin/elastishadow/CMakeLists.txt
+1,272 −0 bin/elastishadow/main.c
+47 −0 format-check.py
+0 −24 format-check.sh
+9 −0 include/aws/mqtt/mqtt.h
+54 −0 include/aws/mqtt/private/client_impl.h
+24 −0 include/aws/mqtt/private/client_impl_shared.h
+204 −0 include/aws/mqtt/private/mqtt311_listener.h
+220 −0 include/aws/mqtt/private/request-response/protocol_adapter.h
+23 −0 include/aws/mqtt/private/request-response/request_response_client.h
+264 −0 include/aws/mqtt/private/request-response/subscription_manager.h
+2 −0 include/aws/mqtt/private/shared.h
+274 −0 include/aws/mqtt/request-response/request_response_client.h
+3 −0 include/aws/mqtt/v5/mqtt5_client.h
+176 −58 source/client.c
+6 −0 source/client_channel_handler.c
+9 −0 source/client_impl_shared.c
+25 −0 source/mqtt.c
+329 −0 source/mqtt311_listener.c
+2 −3 source/packets.c
+964 −0 source/request-response/protocol_adapter.c
+2,276 −0 source/request-response/request_response_client.c
+822 −0 source/request-response/subscription_manager.c
+1 −1 source/shared.c
+1 −1 source/v5/mqtt5_client.c
+1 −0 source/v5/mqtt5_listener.c
+14 −0 source/v5/mqtt5_to_mqtt3_adapter.c
+135 −3 tests/CMakeLists.txt
+1,784 −0 tests/request-response/protocol_adapter_tests.c
+3,151 −0 tests/request-response/request_response_client_tests.c
+2,877 −0 tests/request-response/subscription_manager_tests.c
+739 −998 tests/v3/connection_state_test.c
+488 −0 tests/v3/mqtt311_listener_test.c
+582 −0 tests/v3/mqtt311_testing_utils.c
+155 −0 tests/v3/mqtt311_testing_utils.h
+51 −2 tests/v3/mqtt_mock_server_handler.c
+18 −0 tests/v3/mqtt_mock_server_handler.h
+22 −42 tests/v5/mqtt5_client_tests.c
+26 −0 tests/v5/mqtt5_testing_utils.c
+20 −0 tests/v5/mqtt5_testing_utils.h
+0 −4 tests/v5/mqtt5_to_mqtt3_adapter_tests.c
+2 −1 tests/v5/mqtt5_topic_alias_tests.c
2 changes: 1 addition & 1 deletion crt/aws-lc
2 changes: 1 addition & 1 deletion crt/s2n
Submodule s2n updated from 87f4a0 to 08d413
13 changes: 12 additions & 1 deletion source/http_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,18 @@ static void s_on_stream_complete(struct aws_http_stream *native_stream, int erro
}

/* DECREF python self, we don't need to force it to stay alive any longer. */
Py_XDECREF(stream->self_proxy);
PyObject *self = Py_None;
#if PY_VERSION_HEX >= 0x030D0000 /* Check if Python version is 3.13 or higher */
/* Ignore error, stream is already complete */
PyWeakref_GetRef(stream->self_proxy, &self) < 0);/* strong reference */
#else
/* PyWeakref_GetObject is deprecated since python 3.13 */
PyWeakref_GetObject(stream->self_proxy); /* borrowed reference */
#endif
Py_XDECREF(self);
#if PY_VERSION_HEX >= 0x030D0000 /* Check if Python version is 3.13 or higher */
Py_XDECREF(self);
#endif

PyGILState_Release(state);
/*************** GIL RELEASE ***************/
Expand Down
22 changes: 10 additions & 12 deletions source/mqtt_client_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static void s_on_connection_success(
}

PyObject *self = Py_None;
#if PY_VERSION_HEX >= 0x030D0000 // Check if Python version is 3.13 or higher
#if PY_VERSION_HEX >= 0x030D0000 /* Check if Python version is 3.13 or higher */
if (PyWeakref_GetRef(py_connection->self_proxy, &self) < 0) { /* strong reference */
PyErr_WriteUnraisable(PyErr_Occurred());
goto on_done;
Expand Down Expand Up @@ -180,8 +180,8 @@ static void s_on_connection_failure(struct aws_mqtt_client_connection *connectio
return; /* Python has shut down. Nothing matters anymore, but don't crash */
}

PyObject *self = Py_None;
#if PY_VERSION_HEX >= 0x030D0000 // Check if Python version is 3.13 or higher
PyObject *self = Py_None;
#if PY_VERSION_HEX >= 0x030D0000 /* Check if Python version is 3.13 or higher */
if (PyWeakref_GetRef(py_connection->self_proxy, &self) < 0) { /* strong reference */
PyErr_WriteUnraisable(PyErr_Occurred());
goto on_done;
Expand Down Expand Up @@ -222,7 +222,7 @@ static void s_on_connection_interrupted(struct aws_mqtt_client_connection *conne

/* Ensure that python class is still alive */
PyObject *self = Py_None;
#if PY_VERSION_HEX >= 0x030D0000 // Check if Python version is 3.13 or higher
#if PY_VERSION_HEX >= 0x030D0000 /* Check if Python version is 3.13 or higher */
if (PyWeakref_GetRef(py_connection->self_proxy, &self) < 0) { /* strong reference */
PyErr_WriteUnraisable(PyErr_Occurred());
goto on_done;
Expand Down Expand Up @@ -268,8 +268,8 @@ static void s_on_connection_resumed(
}

/* Ensure that python class is still alive */
PyObject *self = Py_None;
#if PY_VERSION_HEX >= 0x030D0000 // Check if Python version is 3.13 or higher
PyObject *self = Py_None;
#if PY_VERSION_HEX >= 0x030D0000 /* Check if Python version is 3.13 or higher */
if (PyWeakref_GetRef(py_connection->self_proxy, &self) < 0) { /* strong reference */
PyErr_WriteUnraisable(PyErr_Occurred());
goto on_done;
Expand Down Expand Up @@ -312,8 +312,8 @@ static void s_on_connection_closed(

struct mqtt_connection_binding *py_connection = userdata;
/* Ensure that python class is still alive */
PyObject *self = Py_None;
#if PY_VERSION_HEX >= 0x030D0000 // Check if Python version is 3.13 or higher
PyObject *self = Py_None;
#if PY_VERSION_HEX >= 0x030D0000 /* Check if Python version is 3.13 or higher */
if (PyWeakref_GetRef(py_connection->self_proxy, &self) < 0) { /* strong reference */
PyErr_WriteUnraisable(PyErr_Occurred());
goto on_done;
Expand All @@ -332,7 +332,6 @@ static void s_on_connection_closed(
}
}


on_done:
#if PY_VERSION_HEX >= 0x030D0000
Py_XDECREF(self);
Expand Down Expand Up @@ -604,8 +603,8 @@ static void s_ws_handshake_transform(
}

/* Ensure python mqtt connection object is still alive */
PyObject *connection_py = Py_None;
#if PY_VERSION_HEX >= 0x030D0000 // Check if Python version is 3.13 or higher
PyObject *connection_py = Py_None;
#if PY_VERSION_HEX >= 0x030D0000 /* Check if Python version is 3.13 or higher */
if (PyWeakref_GetRef(connection_binding->self_proxy, &connection_py) < 0) { /* strong reference */
aws_raise_error(AWS_ERROR_INVALID_STATE);
goto done;
Expand Down Expand Up @@ -676,7 +675,6 @@ done:;
Py_XDECREF(connection_py);
#endif


if (ws_transform_capsule) {
Py_DECREF(ws_transform_capsule);
} else if (ws_transform_data) {
Expand Down

0 comments on commit d19acc8

Please sign in to comment.