svn commit: samba r23241 - in branches: SAMBA_3_0/source/smbd
SAMBA_3_0_26/source/smbd
vlendec at samba.org
vlendec at samba.org
Wed May 30 13:41:39 GMT 2007
Author: vlendec
Date: 2007-05-30 13:41:38 +0000 (Wed, 30 May 2007)
New Revision: 23241
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23241
Log:
In preparation for the cluster messaging import the parent smbd needs to
respond to events.c style events.
Modified:
branches/SAMBA_3_0/source/smbd/server.c
branches/SAMBA_3_0_26/source/smbd/server.c
Changeset:
Modified: branches/SAMBA_3_0/source/smbd/server.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/server.c 2007-05-30 10:24:40 UTC (rev 23240)
+++ branches/SAMBA_3_0/source/smbd/server.c 2007-05-30 13:41:38 UTC (rev 23241)
@@ -386,7 +386,8 @@
for each incoming connection */
DEBUG(2,("waiting for a connection\n"));
while (1) {
- fd_set lfds;
+ struct timeval now;
+ fd_set r_fds, w_fds;
int num;
/* Free up temporary memory from the main smbd. */
@@ -404,13 +405,21 @@
}
}
- memcpy((char *)&lfds, (char *)&listen_set,
+ memcpy((char *)&r_fds, (char *)&listen_set,
sizeof(listen_set));
+ FD_ZERO(&w_fds);
+ GetTimeOfDay(&now);
- num = sys_select(maxfd+1,&lfds,NULL,NULL,
+ event_add_to_select_args(smbd_event_context(), &now,
+ &r_fds, &w_fds, &idle_timeout,
+ &maxfd);
+
+ num = sys_select(maxfd+1,&r_fds,&w_fds,NULL,
timeval_is_zero(&idle_timeout) ?
NULL : &idle_timeout);
+ run_events(smbd_event_context(), num, &r_fds, &w_fds);
+
if (num == -1 && errno == EINTR) {
if (got_sig_term) {
exit_server_cleanly(NULL);
@@ -427,6 +436,10 @@
continue;
}
+#if 0
+ Deactivated for now, this needs to become a timed event
+ vl
+
/* If the idle timeout fired and we don't have any connected
* users, exit gracefully. We should be running under a process
* controller that will restart us if necessry.
@@ -434,6 +447,7 @@
if (num == 0 && count_all_current_connections() == 0) {
exit_server_cleanly("idle timeout");
}
+#endif
/* check if we need to reload services */
check_reload(time(NULL));
@@ -447,11 +461,11 @@
s = -1;
for(i = 0; i < num_sockets; i++) {
- if(FD_ISSET(fd_listenset[i],&lfds)) {
+ if(FD_ISSET(fd_listenset[i],&r_fds)) {
s = fd_listenset[i];
/* Clear this so we don't look
at it again. */
- FD_CLR(fd_listenset[i],&lfds);
+ FD_CLR(fd_listenset[i],&r_fds);
break;
}
}
Modified: branches/SAMBA_3_0_26/source/smbd/server.c
===================================================================
--- branches/SAMBA_3_0_26/source/smbd/server.c 2007-05-30 10:24:40 UTC (rev 23240)
+++ branches/SAMBA_3_0_26/source/smbd/server.c 2007-05-30 13:41:38 UTC (rev 23241)
@@ -482,7 +482,8 @@
for each incoming connection */
DEBUG(2,("waiting for a connection\n"));
while (1) {
- fd_set lfds;
+ struct timeval now, idle_timeout;
+ fd_set r_fds, w_fds;
int num;
/* Free up temporary memory from the main smbd. */
@@ -500,11 +501,23 @@
}
}
- memcpy((char *)&lfds, (char *)&listen_set,
+ idle_timeout = timeval_zero();
+
+ memcpy((char *)&r_fds, (char *)&listen_set,
sizeof(listen_set));
-
- num = sys_select(maxfd+1,&lfds,NULL,NULL,NULL);
-
+ FD_ZERO(&w_fds);
+ GetTimeOfDay(&now);
+
+ event_add_to_select_args(smbd_event_context(), &now,
+ &r_fds, &w_fds, &idle_timeout,
+ &maxfd);
+
+ num = sys_select(maxfd+1,&r_fds,&w_fds,NULL,
+ timeval_is_zero(&idle_timeout) ?
+ NULL : &idle_timeout);
+
+ run_events(smbd_event_context(), num, &r_fds, &w_fds);
+
if (num == -1 && errno == EINTR) {
if (got_sig_term) {
exit_server_cleanly(NULL);
@@ -533,11 +546,11 @@
s = -1;
for(i = 0; i < num_sockets; i++) {
- if(FD_ISSET(fd_listenset[i],&lfds)) {
+ if(FD_ISSET(fd_listenset[i],&r_fds)) {
s = fd_listenset[i];
/* Clear this so we don't look
at it again. */
- FD_CLR(fd_listenset[i],&lfds);
+ FD_CLR(fd_listenset[i],&r_fds);
break;
}
}
More information about the samba-cvs
mailing list