svn commit: samba r15699 - in trunk/source: lib nmbd
jra at samba.org
jra at samba.org
Thu May 18 19:49:28 GMT 2006
Author: jra
Date: 2006-05-18 19:49:27 +0000 (Thu, 18 May 2006)
New Revision: 15699
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15699
Log:
Make nmbd udp sockets non-blocking to prevent problem
with select returning true but no data being available.
Fix for bug #3779.
Jeremy.
Modified:
trunk/source/lib/util_sock.c
trunk/source/nmbd/nmbd.c
trunk/source/nmbd/nmbd_responserecordsdb.c
trunk/source/nmbd/nmbd_serverlistdb.c
trunk/source/nmbd/nmbd_subnetdb.c
trunk/source/nmbd/nmbd_workgroupdb.c
Changeset:
Modified: trunk/source/lib/util_sock.c
===================================================================
--- trunk/source/lib/util_sock.c 2006-05-18 19:34:25 UTC (rev 15698)
+++ trunk/source/lib/util_sock.c 2006-05-18 19:49:27 UTC (rev 15699)
@@ -278,7 +278,12 @@
memset((char *)&lastip,'\0',sizeof(lastip));
ret = (ssize_t)sys_recvfrom(fd,buf,len,0,(struct sockaddr *)&sock,&socklen);
if (ret <= 0) {
- DEBUG(2,("read socket failed. ERRNO=%s\n",strerror(errno)));
+ /* Don't print a low debug error for a non-blocking socket. */
+ if (errno == EAGAIN) {
+ DEBUG(10,("read socket returned EAGAIN. ERRNO=%s\n",strerror(errno)));
+ } else {
+ DEBUG(2,("read socket failed. ERRNO=%s\n",strerror(errno)));
+ }
return(0);
}
Modified: trunk/source/nmbd/nmbd.c
===================================================================
--- trunk/source/nmbd/nmbd.c 2006-05-18 19:34:25 UTC (rev 15698)
+++ trunk/source/nmbd/nmbd.c 2006-05-18 19:49:27 UTC (rev 15699)
@@ -605,6 +605,10 @@
set_socket_options( ClientNMB, "SO_BROADCAST" );
set_socket_options( ClientDGRAM, "SO_BROADCAST" );
+ /* Ensure we're non-blocking. */
+ set_blocking( ClientNMB, False);
+ set_blocking( ClientDGRAM, False);
+
DEBUG( 3, ( "open_sockets: Broadcast sockets opened.\n" ) );
return( True );
}
Modified: trunk/source/nmbd/nmbd_responserecordsdb.c
===================================================================
--- trunk/source/nmbd/nmbd_responserecordsdb.c 2006-05-18 19:34:25 UTC (rev 15698)
+++ trunk/source/nmbd/nmbd_responserecordsdb.c 2006-05-18 19:49:27 UTC (rev 15699)
@@ -23,8 +23,6 @@
#include "includes.h"
-extern int ClientNMB;
-
int num_response_packets = 0;
/***************************************************************************
Modified: trunk/source/nmbd/nmbd_serverlistdb.c
===================================================================
--- trunk/source/nmbd/nmbd_serverlistdb.c 2006-05-18 19:34:25 UTC (rev 15698)
+++ trunk/source/nmbd/nmbd_serverlistdb.c 2006-05-18 19:49:27 UTC (rev 15699)
@@ -23,8 +23,6 @@
#include "includes.h"
-extern int ClientNMB;
-
int updatecount = 0;
/*******************************************************************
Modified: trunk/source/nmbd/nmbd_subnetdb.c
===================================================================
--- trunk/source/nmbd/nmbd_subnetdb.c 2006-05-18 19:34:25 UTC (rev 15698)
+++ trunk/source/nmbd/nmbd_subnetdb.c 2006-05-18 19:49:27 UTC (rev 15699)
@@ -26,8 +26,6 @@
#include "includes.h"
extern struct in_addr loopback_ip;
-extern int ClientNMB;
-extern int ClientDGRAM;
extern int global_nmb_port;
/* This is the broadcast subnets database. */
@@ -118,6 +116,10 @@
/* Make sure we can broadcast from these sockets. */
set_socket_options(nmb_sock,"SO_BROADCAST");
set_socket_options(dgram_sock,"SO_BROADCAST");
+
+ /* Set them non-blocking. */
+ set_blocking(nmb_sock, False);
+ set_blocking(dgram_sock, False);
}
subrec = SMB_MALLOC_P(struct subnet_record);
Modified: trunk/source/nmbd/nmbd_workgroupdb.c
===================================================================
--- trunk/source/nmbd/nmbd_workgroupdb.c 2006-05-18 19:34:25 UTC (rev 15698)
+++ trunk/source/nmbd/nmbd_workgroupdb.c 2006-05-18 19:49:27 UTC (rev 15699)
@@ -23,8 +23,6 @@
#include "includes.h"
-extern int ClientNMB;
-
extern uint16 samba_nb_type;
int workgroup_count = 0; /* unique index key: one for each workgroup */
More information about the samba-cvs
mailing list