ret = cmd->sock->ops->recvmsg(cmd->sock, &stream_info,
sizeof(struct lttcomm_relayd_add_stream), 0);
if (ret < sizeof(struct lttcomm_relayd_add_stream)) {
- ERR("Relay didn't receive valid add_stream struct size : %d", ret);
+ if (ret == 0) {
+ /* Orderly shutdown. Not necessary to print an error. */
+ DBG("Socket %d did an orderly shutdown", cmd->sock->fd);
+ } else {
+ ERR("Relay didn't receive valid add_stream struct size : %d", ret);
+ }
ret = -1;
goto end_no_session;
}
ret = cmd->sock->ops->recvmsg(cmd->sock, &stream_info,
sizeof(struct lttcomm_relayd_close_stream), 0);
if (ret < sizeof(struct lttcomm_relayd_close_stream)) {
- ERR("Relay didn't receive valid add_stream struct size : %d", ret);
+ if (ret == 0) {
+ /* Orderly shutdown. Not necessary to print an error. */
+ DBG("Socket %d did an orderly shutdown", cmd->sock->fd);
+ } else {
+ ERR("Relay didn't receive valid add_stream struct size : %d", ret);
+ }
ret = -1;
goto end_no_session;
}
DBG2("Relay receiving metadata, waiting for %" PRIu64 " bytes", data_size);
ret = cmd->sock->ops->recvmsg(cmd->sock, data_buffer, data_size, 0);
if (ret < 0 || ret != data_size) {
+ if (ret == 0) {
+ /* Orderly shutdown. Not necessary to print an error. */
+ DBG("Socket %d did an orderly shutdown", cmd->sock->fd);
+ } else {
+ ERR("Relay didn't receive the whole metadata");
+ }
ret = -1;
- ERR("Relay didn't receive the whole metadata");
goto end;
}
metadata_struct = (struct lttcomm_relayd_metadata_payload *) data_buffer;
/* Get version from the other side. */
ret = cmd->sock->ops->recvmsg(cmd->sock, &msg, sizeof(msg), 0);
if (ret < 0 || ret != sizeof(msg)) {
+ if (ret == 0) {
+ /* Orderly shutdown. Not necessary to print an error. */
+ DBG("Socket %d did an orderly shutdown", cmd->sock->fd);
+ } else {
+ ERR("Relay failed to receive the version values.");
+ }
ret = -1;
- ERR("Relay failed to receive the version values.");
goto end;
}
ret = cmd->sock->ops->recvmsg(cmd->sock, &msg, sizeof(msg), 0);
if (ret < sizeof(msg)) {
- ERR("Relay didn't receive valid data_pending struct size : %d", ret);
+ if (ret == 0) {
+ /* Orderly shutdown. Not necessary to print an error. */
+ DBG("Socket %d did an orderly shutdown", cmd->sock->fd);
+ } else {
+ ERR("Relay didn't receive valid data_pending struct size : %d",
+ ret);
+ }
ret = -1;
goto end_no_session;
}
ret = cmd->sock->ops->recvmsg(cmd->sock, &msg, sizeof(msg), 0);
if (ret < sizeof(msg)) {
- ERR("Relay didn't receive valid begin data_pending struct size: %d",
- ret);
+ if (ret == 0) {
+ /* Orderly shutdown. Not necessary to print an error. */
+ DBG("Socket %d did an orderly shutdown", cmd->sock->fd);
+ } else {
+ ERR("Relay didn't receive valid begin data_pending struct size: %d",
+ ret);
+ }
ret = -1;
goto end_no_session;
}
ret = cmd->sock->ops->recvmsg(cmd->sock, &msg, sizeof(msg), 0);
if (ret < sizeof(msg)) {
- ERR("Relay didn't receive valid begin data_pending struct size: %d",
- ret);
+ if (ret == 0) {
+ /* Orderly shutdown. Not necessary to print an error. */
+ DBG("Socket %d did an orderly shutdown", cmd->sock->fd);
+ } else {
+ ERR("Relay didn't receive valid begin data_pending struct size: %d",
+ ret);
+ }
ret = -1;
goto end_no_session;
}
ret = cmd->sock->ops->recvmsg(cmd->sock, &msg, sizeof(msg), 0);
if (ret < sizeof(msg)) {
- ERR("Relay didn't receive valid end data_pending struct size: %d",
- ret);
+ if (ret == 0) {
+ /* Orderly shutdown. Not necessary to print an error. */
+ DBG("Socket %d did an orderly shutdown", cmd->sock->fd);
+ } else {
+ ERR("Relay didn't receive valid end data_pending struct size: %d",
+ ret);
+ }
ret = -1;
goto end_no_session;
}
ret = cmd->sock->ops->recvmsg(cmd->sock, &data_hdr,
sizeof(struct lttcomm_relayd_data_hdr), 0);
if (ret <= 0) {
- ERR("Connections seems to be closed");
+ if (ret == 0) {
+ /* Orderly shutdown. Not necessary to print an error. */
+ DBG("Socket %d did an orderly shutdown", cmd->sock->fd);
+ } else {
+ ERR("Unable to receive data header on sock %d", cmd->sock->fd);
+ }
ret = -1;
goto end;
}
data_size, stream_id, net_seq_num);
ret = cmd->sock->ops->recvmsg(cmd->sock, data_buffer, data_size, 0);
if (ret <= 0) {
+ if (ret == 0) {
+ /* Orderly shutdown. Not necessary to print an error. */
+ DBG("Socket %d did an orderly shutdown", cmd->sock->fd);
+ }
ret = -1;
goto end_unlock;
}