A small memory footprint AMQP implimentation
Dependents: iothub_client_sample_amqp remote_monitoring simplesample_amqp
Diff: session.c
- Revision:
- 25:1101516ee67d
- Parent:
- 23:1111ee8bcba4
- Child:
- 27:d74f1cea23e1
diff -r 2c59c2d43ebf -r 1101516ee67d session.c --- a/session.c Mon May 08 10:50:45 2017 -0700 +++ b/session.c Mon May 22 10:35:21 2017 -0700 @@ -450,9 +450,10 @@ } else { + LINK_ENDPOINT_INSTANCE* link_endpoint; detach_destroy(detach_handle); - LINK_ENDPOINT_INSTANCE* link_endpoint = find_link_endpoint_by_input_handle(session_instance, remote_handle); + link_endpoint = find_link_endpoint_by_input_handle(session_instance, remote_handle); if (link_endpoint == NULL) { end_session_with_error(session_instance, "amqp:session:unattached-handle", ""); @@ -498,6 +499,7 @@ else { LINK_ENDPOINT_INSTANCE* link_endpoint_instance = NULL; + size_t i; session_instance->remote_incoming_window = flow_next_incoming_id + flow_incoming_window - session_instance->next_outgoing_id; @@ -513,7 +515,7 @@ link_endpoint_instance->frame_received_callback(link_endpoint_instance->callback_context, performative, payload_size, payload_bytes); } - size_t i = 0; + i = 0; while ((session_instance->remote_incoming_window > 0) && (i < session_instance->link_endpoint_count)) { /* notify the caller that it can send here */ @@ -548,13 +550,14 @@ } else { + LINK_ENDPOINT_INSTANCE* link_endpoint; transfer_destroy(transfer_handle); session_instance->next_incoming_id++; session_instance->remote_outgoing_window--; session_instance->incoming_window--; - LINK_ENDPOINT_INSTANCE* link_endpoint = find_link_endpoint_by_input_handle(session_instance, remote_handle); + link_endpoint = find_link_endpoint_by_input_handle(session_instance, remote_handle); if (link_endpoint == NULL) { end_session_with_error(session_instance, "amqp:session:unattached-handle", ""); @@ -592,6 +595,7 @@ } else { + end_destroy(end_handle); if ((session_instance->session_state != SESSION_STATE_END_RCVD) && (session_instance->session_state != SESSION_STATE_DISCARDING)) { @@ -1444,6 +1448,7 @@ size_t temp_current_payload_index = current_payload_index; uint32_t temp_current_payload_pos = current_payload_pos; AMQP_VALUE multi_transfer_amqp_value; + PAYLOAD* transfer_frame_payloads; bool more; if (current_transfer_frame_payload_size > available_frame_size) @@ -1489,7 +1494,7 @@ } transfer_frame_payload_count = (uint32_t)(temp_current_payload_index - current_payload_index + 1); - PAYLOAD* transfer_frame_payloads = (PAYLOAD*)malloc(transfer_frame_payload_count * sizeof(PAYLOAD)); + transfer_frame_payloads = (PAYLOAD*)malloc(transfer_frame_payload_count * sizeof(PAYLOAD)); if (transfer_frame_payloads == NULL) { amqpvalue_destroy(multi_transfer_amqp_value);