improved debug output for when sendto fails.

This commit is contained in:
gardners 2012-05-01 06:43:22 +09:30
parent 6e9d9783b8
commit b335424cd5

View File

@ -160,7 +160,7 @@ int overlay_mdp_reply(int sock,struct sockaddr_un *recvaddr,int recvaddrlen,
int r=sendto(sock,(char *)mdpreply,replylen,0,
(struct sockaddr *)recvaddr,recvaddrlen);
if (r<replylen) {
perror("sendto");
perror("sendto(d)");
WHY("sendto() failed when sending MDP reply");
printf("sock=%d, r=%d\n",sock,r);
return -1;
@ -460,7 +460,7 @@ int overlay_saw_mdp_frame(int interface, overlay_mdp_frame *mdp,long long now)
int r=sendto(mdp_named_socket,mdp,overlay_mdp_relevant_bytes(mdp),0,(struct sockaddr*)&addr,sizeof(addr));
printf("r=%d\n",r);
if (r==overlay_mdp_relevant_bytes(mdp)) return 0;
perror("sendto");
perror("sendto(e)");
return WHY("Failed to pass received MDP frame to client");
} else {
/* No socket is bound, ignore the packet ... except for magic sockets */
@ -1083,7 +1083,7 @@ int overlay_mdp_send(overlay_mdp_frame *mdp,int flags,int timeout_ms)
mdp->packetTypeAndFlags=MDP_ERROR;
mdp->error.error=1;
snprintf(mdp->error.message,128,"Error sending frame to MDP server.");
perror("sendto");
perror("sendto(f)");
/* Clear socket so that we have the chance of reconnecting */
overlay_mdp_client_done();
return -1;