Branch Coverage

amqp_socket.c
Criterion Covered Total %
branch 37 316 11.7


line true false branch
91 0 1 assert(self);
92 0 1 assert(self->klass->send);
98 0 0 assert(self);
99 0 0 assert(self->klass->recv);
104 0 0 assert(self);
105 0 0 assert(self->klass->open);
111 0 1 assert(self);
112 0 1 assert(self->klass->open);
117 0 0 assert(self);
118 0 0 assert(self->klass->close);
123 1 33 if (self) {
124 0 1 assert(self->klass->delete);
130 0 1 assert(self);
131 0 1 assert(self->klass->get_sockfd);
142 0 1 assert(event == AMQP_SF_POLLIN || event == AMQP_SF_POLLOUT);
1 0 assert(event == AMQP_SF_POLLIN || event == AMQP_SF_POLLOUT);
156 0 1 if (-1 > timeout_ms) {
162 0 1 if (0 < res) {
167 1 0 } else if (0 == res) {
170 0 0 switch (amqp_os_socket_error()) {
236 1 0 if (-1 == fd) {
260 0 1 if (res > 0) {
263 0 0 if (0 == len_left) {
269 0 1 if (AMQP_STATUS_OK == res) {
272 0 1 if (AMQP_STATUS_TIMEOUT == res) {
286 0 1 if (AMQP_STATUS_OK != res) {
369 0 1 if (-1 == sockfd) {
375 1 0 if (flags == -1 || fcntl(sockfd, F_SETFD, (long)(flags | FD_CLOEXEC)) == -1) {
0 1 if (flags == -1 || fcntl(sockfd, F_SETFD, (long)(flags | FD_CLOEXEC)) == -1) {
382 1 0 if (flags == -1 || fcntl(sockfd, F_SETFL, (long)(flags | O_NONBLOCK)) == -1) {
0 1 if (flags == -1 || fcntl(sockfd, F_SETFL, (long)(flags | O_NONBLOCK)) == -1) {
396 0 1 if (0 != setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one))) {
402 0 1 if (0 != setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof(one))) {
407 0 1 if (0 == connect(sockfd, addr->ai_addr, addr->ai_addrlen)) {
411 0 1 if (EINPROGRESS != errno) {
417 1 0 if (AMQP_STATUS_OK != last_error) {
425 0 0 if (-1 == getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &result, &result_len) ||
426 0 0 result != 0) {
450 0 1 if (AMQP_STATUS_OK != last_error) {
462 0 1 if (0 != last_error) {
466 1 0 for (addr = address_list; addr; addr = addr->ai_next) {
469 0 1 if (sockfd >= 0) {
472 1 0 } else if (sockfd == AMQP_STATUS_TIMEOUT) {
479 0 1 if (last_error != AMQP_STATUS_OK || sockfd == -1) {
0 0 if (last_error != AMQP_STATUS_OK || sockfd == -1) {
497 0 0 if (sizeof(header) == res) {
526 0 0 if (l.len == r.len) {
527 0 0 if (l.bytes && r.bytes) {
0 0 if (l.bytes && r.bytes) {
528 0 0 if (0 == memcmp(l.bytes, r.bytes, l.len)) {
544 0 0 assert(NULL != mechanisms.bytes);
552 0 0 for (; current != end; start = current + 1) {
558 0 0 if (NULL == current) {
563 0 0 if (bytes_equal(mechanism, supported_mechanism)) {
585 0 0 if (response.bytes == NULL)
604 0 0 if (response.bytes == NULL) {
640 0 0 if (res < 0) {
658 0 0 if (res < 0) {
660 0 0 if (-1 == fd) {
673 0 0 if (AMQP_STATUS_OK == res) {
684 0 0 if (AMQP_STATUS_OK != res) {
694 0 0 while (amqp_data_in_buffer(state)) {
698 0 0 if (AMQP_STATUS_OK != res) {
702 0 0 if (frame.frame_type != 0) {
708 0 0 if (NULL == channel_pool) {
715 0 0 if (frame_copy == NULL || link == NULL) {
0 0 if (frame_copy == NULL || link == NULL) {
724 0 0 if (state->last_queued_frame == NULL) {
733 0 0 if (AMQP_STATUS_OK != res) {
747 0 0 while (amqp_data_in_buffer(state)) {
750 0 0 if (AMQP_STATUS_OK != res) {
754 0 0 if (AMQP_FRAME_HEARTBEAT == decoded_frame->frame_type) {
759 0 0 if (decoded_frame->frame_type != 0) {
767 0 0 if (AMQP_STATUS_TIMER_FAILURE == res) {
769 0 0 } else if (AMQP_STATUS_TIMEOUT == res) {
775 0 0 if (AMQP_STATUS_OK != res) {
787 0 0 if (AMQP_STATUS_TIMEOUT == res) {
788 0 0 if (amqp_time_equal(deadline, state->next_recv_heartbeat)) {
791 0 0 } else if (amqp_time_equal(deadline, timeout_deadline)) {
793 0 0 } else if (amqp_time_equal(deadline, state->next_send_heartbeat)) {
799 0 0 } else if (AMQP_STATUS_OK != res) {
813 0 0 if (NULL == channel_pool) {
820 0 0 if (NULL == link || NULL == frame_copy) {
0 0 if (NULL == link || NULL == frame_copy) {
832 0 0 if (NULL == link) {
836 0 0 if (NULL == state->first_queued_frame) {
850 0 0 if (NULL == link) {
854 0 0 if (NULL == state->first_queued_frame) {
873 0 0 for (cur = state->first_queued_frame; NULL != cur; cur = cur->next) {
876 0 0 if (channel == frame_ptr->channel) {
878 0 0 if (NULL == state->first_queued_frame) {
891 0 0 if (AMQP_STATUS_OK != res) {
895 0 0 if (channel == decoded_frame->channel) {
899 0 0 if (res != AMQP_STATUS_OK) {
917 0 0 if (AMQP_STATUS_OK != res) {
921 0 0 if (state->first_queued_frame != NULL) {
924 0 0 if (state->first_queued_frame == NULL) {
944 0 0 if (res != AMQP_STATUS_OK) {
949 0 0 if (AMQP_STATUS_OK != res) {
953 0 0 if (AMQP_FRAME_METHOD != frame.frame_type ||
1002 0 0 while (*list != 0) {
1003 0 0 if (*list == expected) {
1021 0 1 if (status < 0) {
1030 0 0 if (status != AMQP_STATUS_OK) {
1031 0 0 if (status == AMQP_STATUS_TIMEOUT) {
1045 0 0 if (!((frame.frame_type == AMQP_FRAME_METHOD) &&
1049 0 0 (frame.payload.method.id == AMQP_CHANNEL_CLOSE_METHOD))) ||
1050 0 0 ((frame.channel == 0) &&
1051 0 0 (frame.payload.method.id == AMQP_CONNECTION_CLOSE_METHOD))))) {
1057 0 0 if (NULL == channel_pool) {
1064 0 0 if (frame_copy == NULL || link == NULL) {
0 0 if (frame_copy == NULL || link == NULL) {
1073 0 0 if (state->last_queued_frame == NULL) {
1086 0 0 : AMQP_RESPONSE_SERVER_EXCEPTION;
1102 0 1 if (res != AMQP_STATUS_OK) {
1120 0 0 if (res != AMQP_STATUS_OK) {
1131 0 0 if (state->most_recent_api_result.reply_type == AMQP_RESPONSE_NORMAL) {
1153 0 0 assert(base != NULL);
1154 0 0 assert(result != NULL);
1155 0 0 assert(pool != NULL);
1157 0 0 if (NULL == add) {
1166 0 0 if (NULL == temp_result.entries) {
1170 0 0 for (i = 0; i < base->num_entries; ++i) {
1174 0 0 for (i = 0; i < add->num_entries; ++i) {
1177 0 0 if (NULL != e) {
1178 0 0 if (AMQP_FIELD_KIND_TABLE == add->entries[i].value.kind &&
1179 0 0 AMQP_FIELD_KIND_TABLE == e->value.kind) {
1186 0 0 if (AMQP_STATUS_OK != res) {
1224 0 0 if (channel_max < 0 || channel_max > UINT16_MAX) {
0 0 if (channel_max < 0 || channel_max > UINT16_MAX) {
1229 0 0 if (frame_max < 0) {
1234 0 0 if (heartbeat < 0 || heartbeat > UINT16_MAX) {
0 0 if (heartbeat < 0 || heartbeat > UINT16_MAX) {
1240 0 0 if (AMQP_STATUS_OK != res) {
1245 0 0 if (AMQP_STATUS_OK != res) {
1251 0 0 if (AMQP_STATUS_OK != res) {
1257 0 0 if ((s->version_major != AMQP_PROTOCOL_VERSION_MAJOR) ||
1258 0 0 (s->version_minor != AMQP_PROTOCOL_VERSION_MINOR)) {
1266 0 0 if (AMQP_STATUS_OK != res) {
1273 0 0 if (!sasl_mechanism_in_list(s->mechanisms, sasl_method)) {
1289 0 0 if (NULL == channel_pool) {
1295 0 0 if (response_bytes.bytes == NULL) {
1328 0 0 if (AMQP_STATUS_OK != res) {
1339 0 0 if (res < 0) {
1351 0 0 if (AMQP_STATUS_OK != res) {
1356 0 0 if (AMQP_CONNECTION_CLOSE_METHOD == method.id) {
1370 0 0 if (server_channel_max != 0 &&
0 0 if (server_channel_max != 0 &&
1371 0 0 (server_channel_max < client_channel_max || client_channel_max == 0)) {
1373 0 0 } else if (server_channel_max == 0 && client_channel_max == 0) {
0 0 } else if (server_channel_max == 0 && client_channel_max == 0) {
1377 0 0 if (server_frame_max != 0 && server_frame_max < client_frame_max) {
0 0 if (server_frame_max != 0 && server_frame_max < client_frame_max) {
1381 0 0 if (server_heartbeat != 0 && server_heartbeat < client_heartbeat) {
0 0 if (server_heartbeat != 0 && server_heartbeat < client_heartbeat) {
1387 0 0 if (res < 0) {
1399 0 0 if (res < 0) {
1415 0 0 if (result.reply_type != AMQP_RESPONSE_NORMAL) {