[pisa-src] r1330 - trunk/pisacd/cdmain.c

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Tue, 27 Oct 2009 15:52:13 +0100

Author: tjansen
Date: Tue Oct 27 15:52:13 2009
New Revision: 1330

Log:
Moved the function cd_get_maxfd to cd_do_main.

For no apparent reason, we had different ways to find out what the highest
filedescriptor was on OpenWrt and the rest of the platforms. Since only two
lines were left (and one +1 too much), the function was removed.

Modified:
   trunk/pisacd/cdmain.c

Modified: trunk/pisacd/cdmain.c
==============================================================================
--- trunk/pisacd/cdmain.c       Tue Oct 27 15:39:26 2009        (r1329)
+++ trunk/pisacd/cdmain.c       Tue Oct 27 15:52:13 2009        (r1330)
@@ -67,7 +67,6 @@
 static void cd_print_version(void);
 static void cd_reload_confs(int quitcode);
 static void cd_quit(int quitcode);
-static inline int cd_get_maxfd(void);
 
 /**
  * The main function of this client daemon.
@@ -251,8 +250,8 @@
 
        PISA_INFO("\nEntering main loop\n");
 
-       /* TODO Inline this if we can get rid of the ifdef. -- Thomas */
-       maxfd = cd_get_maxfd() + 1;
+       maxfd = pisa_maxof(5, cd_ctx.tunnel, cd_ctx.fd_pisaconf,
+               cd_ctx.tunc, cd_ctx.tund, cd_ctx.scheduler.pipe_main[0]) + 1;
 
        while (cd_ctx.is_cd_running || cd_ctx.pending) {
                /* sockets.tunnel needs to be always included in the reading fd 
list */
@@ -462,30 +461,6 @@
        cdconf_read_basic_confs(&cd_cfg);
 }
 
-/**
- * Get the maximum file descriptor
- *
- * @param the maximum fd
- */
-static inline int cd_get_maxfd(void)
-{
-       int     maxfd = 0;
-#ifdef CONFIG_PISA_OPENWRT
-       int     tmfd;
-
-       tmfd = pisa_maxInt(cd_ctx.tunnel, cd_ctx.fd_pisaconf);
-       tmfd = pisa_maxInt(tmfd, cd_ctx.tunc);
-       tmfd = pisa_maxInt(tmfd, cd_ctx.tund);
-       tmfd = pisa_maxInt(tmfd, cd_ctx.scheduler.pipe_main[0]);
-       maxfd = tmfd + 1;
-#else
-       maxfd = pisa_maxof(5, cd_ctx.tunnel, cd_ctx.fd_pisaconf,
-               cd_ctx.tunc, cd_ctx.tund, cd_ctx.scheduler.pipe_main[0]) + 1;
-#endif
-
-       return maxfd;
-}
-
 #ifdef CONFIG_PISA_PERFORMANCE
 
 /**

Other related posts:

  • » [pisa-src] r1330 - trunk/pisacd/cdmain.c - Thomas Jansen