From 9c6acf4595d14cb0fc0c9bf17ce02de73af127cd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 6 Oct 2000 22:37:42 +0000 Subject: Fix from RFritz@lbl.gov for Linux ECONREFUSED async errors on Linux. Jeremy. (This used to be commit dd804fdb96ff49645647787c197a61a6515a474d) --- source3/libsmb/nmblib.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source3/libsmb') diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c index e290ee5d4f..01c4001f4c 100644 --- a/source3/libsmb/nmblib.c +++ b/source3/libsmb/nmblib.c @@ -750,6 +750,7 @@ struct packet_struct *read_packet(int fd,enum packet_type packet_type) static BOOL send_udp(int fd,char *buf,int len,struct in_addr ip,int port) { BOOL ret; + int i; struct sockaddr_in sock_out; /* set the address and port */ @@ -760,9 +761,16 @@ static BOOL send_udp(int fd,char *buf,int len,struct in_addr ip,int port) DEBUG( 5, ( "Sending a packet of len %d to (%s) on port %d\n", len, inet_ntoa(ip), port ) ); + + /* + * Patch to fix asynch error notifications from Linux kernel. + */ - ret = (sendto(fd,buf,len,0,(struct sockaddr *)&sock_out, - sizeof(sock_out)) >= 0); + for (i = 0; i < 5; i++) { + ret = (sendto(fd,buf,len,0,(struct sockaddr *)&sock_out, sizeof(sock_out)) >= 0); + if (ret || errno != ECONNREFUSED) + break; + } if (!ret) DEBUG(0,("Packet send failed to %s(%d) ERRNO=%s\n", -- cgit