summaryrefslogtreecommitdiff
path: root/src/base/serverSelect.c
diff options
context:
space:
mode:
authorxHire <xhire@tuxportal.cz>2009-05-26 00:44:42 +0200
committerxHire <xhire@tuxportal.cz>2009-05-26 01:12:04 +0200
commit409083e69d4bb9d8b1eb492b3474c86e093f2de8 (patch)
tree741e3214c07578cde88e700895f203706284017c /src/base/serverSelect.c
parentb992c007c186fddf31f67a7ed0bd5789cfb9b85e (diff)
Rewritten messages/comments in code of base
Rectified the coding style in code of base
Diffstat (limited to 'src/base/serverSelect.c')
-rw-r--r--src/base/serverSelect.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/base/serverSelect.c b/src/base/serverSelect.c
index 2cf2586..6f8d64e 100644
--- a/src/base/serverSelect.c
+++ b/src/base/serverSelect.c
@@ -1,4 +1,3 @@
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -10,13 +9,13 @@
#include <sys/time.h>
#ifndef __WIN32__
-# include <sys/ioctl.h>
-# include <sys/socket.h>
-# include <sys/select.h>
-#else
-# include <io.h>
-# include <winsock2.h>
-#endif
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/select.h>
+#else /* __WIN32__ */
+#include <io.h>
+#include <winsock2.h>
+#endif /* __WIN32__ */
#include "server.h"
@@ -30,12 +29,10 @@ void select_restart()
#ifndef PUBLIC_SERVER
tv.tv_sec = 0;
tv.tv_usec = 0;
-#endif
-
-#ifdef PUBLIC_SERVER
+#else /* PUBLIC_SERVER */
tv.tv_sec = 0;
tv.tv_usec = 1000;
-#endif
+#endif /* PUBLIC_SERVER */
FD_ZERO(&readfds);
FD_ZERO(&writefds);
@@ -44,7 +41,7 @@ void select_restart()
void select_add_sock_for_read(int sock)
{
- //printf("select_add_sock_for_read %d\n", sock);
+ /*printf("select_add_sock_for_read %d\n", sock);*/
FD_SET(sock, &readfds);
@@ -55,7 +52,7 @@ void select_add_sock_for_read(int sock)
void select_add_sock_for_write(int sock)
{
- //printf("select_add_sock_for_write %d\n", sock);
+ /*printf("select_add_sock_for_write %d\n", sock);*/
FD_SET(sock, &writefds);
@@ -68,7 +65,9 @@ int select_action()
{
int ret;
-#ifdef PUBLIC_SERVER
+#ifndef PUBLIC_SERVER
+ ret = select(max_fd + 1, &readfds, &writefds, (fd_set *) NULL, &tv);
+#else /* PUBLIC_SERVER */
list_t *listClient;
listClient = server_get_list_clients();
@@ -78,11 +77,7 @@ int select_action()
} else {
ret = select(max_fd + 1, &readfds, &writefds, (fd_set *) NULL, &tv);
}
-#endif
-
-#ifndef PUBLIC_SERVER
- ret = select(max_fd + 1, &readfds, &writefds, (fd_set *) NULL, &tv);
-#endif
+#endif /* PUBLIC_SERVER */
return ret;
}
@@ -93,7 +88,7 @@ int select_is_change_sock_for_read(int sock)
ret = FD_ISSET(sock, &readfds);
- //printf("select_is_change_sock %d -> %d\n", sock, ret);
+ /*printf("select_is_change_sock %d -> %d\n", sock, ret);*/
return ret;
}
@@ -104,7 +99,7 @@ int select_is_change_sock_for_write(int sock)
ret = FD_ISSET(sock, &writefds);
- //printf("select_is_change_sock %d -> %d\n", sock, ret);
+ /*printf("select_is_change_sock %d -> %d\n", sock, ret);*/
return ret;
}