Remove all occurences of $Id$.
[tinc] / src / net.c
index 910e86d..2e67de6 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -16,8 +16,6 @@
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-    $Id$
 */
 
 #include "system.h"
@@ -149,7 +147,8 @@ static int build_fdset(fd_set *readset, fd_set *writeset)
                        max = listen_socket[i].udp;
        }
 
-       FD_SET(device_fd, readset);
+       if(device_fd >= 0)
+               FD_SET(device_fd, readset);
        if(device_fd > max)
                max = device_fd;
        
@@ -251,7 +250,7 @@ static void check_dead_connections(void)
                        } else {
                                if(c->status.remove) {
                                        logger(LOG_WARNING, _("Old connection_t for %s (%s) status %04x still lingering, deleting..."),
-                                                  c->name, c->hostname, *(uint32_t *)&c->status);
+                                                  c->name, c->hostname, bitfield_to_int(&c->status, sizeof c->status));
                                        connection_del(c);
                                        continue;
                                }
@@ -294,7 +293,7 @@ static void check_network_activity(fd_set * readset, fd_set * writeset)
        cp();
 
        /* check input from kernel */
-       if(FD_ISSET(device_fd, readset)) {
+       if(device_fd >= 0 && FD_ISSET(device_fd, readset)) {
                if(read_packet(&packet)) {
                        packet.priority = 0;
                        route(myself, &packet);
@@ -366,7 +365,6 @@ int main_loop(void)
        last_graph_dump = now;
        
        srand(now);
-       srand48(now);
 
        running = true;
 
@@ -379,7 +377,13 @@ int main_loop(void)
 
                maxfd = build_fdset(&readset, &writeset);
 
+#ifdef HAVE_MINGW
+               LeaveCriticalSection(&mutex);
+#endif
                r = select(maxfd + 1, &readset, &writeset, NULL, &tv);
+#ifdef HAVE_MINGW
+               EnterCriticalSection(&mutex);
+#endif
 
                if(r < 0) {
                        if(errno != EINTR && errno != EAGAIN) {