mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-23 10:30:19 +00:00
Improve sendto(2) error log messages
This commit is contained in:
parent
9ddcfb87aa
commit
e92e7cb65e
@ -137,7 +137,7 @@ int overlay_mdp_send(int mdp_sockfd, overlay_mdp_frame *mdp, int flags, int time
|
||||
mdp->packetTypeAndFlags=MDP_ERROR;
|
||||
mdp->error.error=1;
|
||||
snprintf(mdp->error.message,128,"Error sending frame to MDP server.");
|
||||
return WHY_perror("sendto(f)");
|
||||
return WHYF_perror("sendto(fd=%d,len=%zu,addr=%s)", mdp_sockfd, (size_t)len, alloca_sockaddr(&addr, addrlen));
|
||||
} else {
|
||||
if (!(flags&MDP_AWAITREPLY)) {
|
||||
return 0;
|
||||
|
@ -982,7 +982,11 @@ int overlay_broadcast_ensemble(struct network_destination *destination, struct o
|
||||
(struct sockaddr *)&destination->address, sizeof(destination->address));
|
||||
ob_free(buffer);
|
||||
if (sent!= len){
|
||||
WHY_perror("sendto(c)");
|
||||
WHYF_perror("sendto(fd=%d,len=%zu,addr=%s)",
|
||||
interface->alarm.poll.fd,
|
||||
(size_t)len,
|
||||
alloca_sockaddr((struct sockaddr *)&destination->address, sizeof destination->address)
|
||||
);
|
||||
// close the interface if we had any error while sending broadcast packets,
|
||||
// unicast packets should not bring the interface down
|
||||
if (destination == interface->destination)
|
||||
|
@ -163,7 +163,7 @@ int overlay_mdp_reply(int sock,struct sockaddr_un *recvaddr, socklen_t recvaddrl
|
||||
int r=sendto(sock,(char *)mdpreply,replylen,0,
|
||||
(struct sockaddr *)recvaddr,recvaddrlen);
|
||||
if (r<replylen) {
|
||||
WHY_perror("sendto(d)");
|
||||
WHYF_perror("sendto(fd=%d,len=%zu,addr=%s)", sock, (size_t)replylen, alloca_sockaddr((struct sockaddr *)recvaddr, recvaddrlen));
|
||||
return WHYF("sendto() failed when sending MDP reply, sock=%d, r=%d", sock, r);
|
||||
} else
|
||||
if (0) DEBUGF("reply of %d bytes sent",r);
|
||||
|
Loading…
x
Reference in New Issue
Block a user