From 0648638fef56a65f9389c8a98f66c57663e8c401 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 May 2006 19:49:44 +0000 Subject: r15700: Make nmbd udp sockets non-blocking to prevent problem with select returning true but no data being available. Fix for bug #3779. Jeremy. (This used to be commit e5787cf75b2e7d50f551f34f28d280c27b0aa134) --- source3/nmbd/nmbd.c | 4 ++++ source3/nmbd/nmbd_responserecordsdb.c | 2 -- source3/nmbd/nmbd_serverlistdb.c | 2 -- source3/nmbd/nmbd_subnetdb.c | 6 ++++-- source3/nmbd/nmbd_workgroupdb.c | 2 -- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'source3/nmbd') diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index fca17d1ff7..9c8f99df25 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -605,6 +605,10 @@ static BOOL open_sockets(BOOL isdaemon, int port) 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 ); } diff --git a/source3/nmbd/nmbd_responserecordsdb.c b/source3/nmbd/nmbd_responserecordsdb.c index a5903ef462..6f22fd906d 100644 --- a/source3/nmbd/nmbd_responserecordsdb.c +++ b/source3/nmbd/nmbd_responserecordsdb.c @@ -23,8 +23,6 @@ #include "includes.h" -extern int ClientNMB; - int num_response_packets = 0; /*************************************************************************** diff --git a/source3/nmbd/nmbd_serverlistdb.c b/source3/nmbd/nmbd_serverlistdb.c index 52d00e1585..cc762ae8d2 100644 --- a/source3/nmbd/nmbd_serverlistdb.c +++ b/source3/nmbd/nmbd_serverlistdb.c @@ -23,8 +23,6 @@ #include "includes.h" -extern int ClientNMB; - int updatecount = 0; /******************************************************************* diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c index b2e1178beb..c3640028d2 100644 --- a/source3/nmbd/nmbd_subnetdb.c +++ b/source3/nmbd/nmbd_subnetdb.c @@ -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 @@ static struct subnet_record *make_subnet(const char *name, enum subnet_type type /* 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); diff --git a/source3/nmbd/nmbd_workgroupdb.c b/source3/nmbd/nmbd_workgroupdb.c index 335d522031..ca665bdf4f 100644 --- a/source3/nmbd/nmbd_workgroupdb.c +++ b/source3/nmbd/nmbd_workgroupdb.c @@ -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 */ -- cgit