DBG3("Relayd waiting for reply of size %ld", size);
ret = sock->ops->recvmsg(sock, data, size, 0);
- if (ret < 0) {
- ret = -errno;
+ if (ret <= 0 || ret != size) {
+ if (ret == 0) {
+ /* Orderly shutdown. */
+ DBG("Socket %d has performed an orderly shutdown", sock->fd);
+ } else {
+ DBG("Receiving reply failed on sock %d for size %lu with ret %d",
+ sock->fd, size, ret);
+ }
+ /* Always return -1 here and the caller can use errno. */
+ ret = -1;
goto error;
}
* Send a RELAYD_CREATE_SESSION command to the relayd with the given socket and
* set session_id of the relayd if we have a successful reply from the relayd.
*
- * On success, return 0 else a negative value being a lttng_error_code returned
- * from the relayd.
+ * On success, return 0 else a negative value which is either an errno error or
+ * a lttng error code from the relayd.
*/
int relayd_create_session(struct lttcomm_sock *sock, uint64_t *session_id)
{
goto error;
}
- /* Recevie response */
+ /* Receive response */
ret = recv_reply(sock, (void *) &reply, sizeof(reply));
if (ret < 0) {
goto error;
goto error;
}
- /* Recevie response */
+ /* Receive response */
ret = recv_reply(sock, (void *) &msg, sizeof(msg));
if (ret < 0) {
goto error;
goto error;
}
- /* Recevie response */
+ /* Receive response */
ret = recv_reply(sock, (void *) &reply, sizeof(reply));
if (ret < 0) {
goto error;
goto error;
}
- /* Recevie response */
+ /* Receive response */
ret = recv_reply(sock, (void *) &reply, sizeof(reply));
if (ret < 0) {
goto error;
goto error;
}
- /* Recevie response */
+ /* Receive response */
ret = recv_reply(sock, (void *) &reply, sizeof(reply));
if (ret < 0) {
goto error;
goto error;
}
- /* Recevie response */
+ /* Receive response */
ret = recv_reply(sock, (void *) &reply, sizeof(reply));
if (ret < 0) {
goto error;
goto error;
}
- /* Recevie response */
+ /* Receive response */
ret = recv_reply(sock, (void *) &reply, sizeof(reply));
if (ret < 0) {
goto error;