Date: Sun Feb 23 21:29:08 CET 2003
User: Derick Rethans
Directory: srm/main/src
Log Message:
[0.25]
- Get rid of stupid macros
Modified files:
srm/main/main.c (version: 1.76)
srm/main/src/srm_protocols.h (version: 1.8)
[FILE: /srm/main/main.c]
--- srm/main/main.c:1.75 Sun Feb 23 19:22:31 2003 GMT
+++ srm/main/main.c Sun Feb 23 19:29:07 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.75 2003/02/23 20:22:31 derick Exp $ */
+/* $Id: cvstemp,v 1.76 2003/02/23 20:29:07 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -292,26 +292,28 @@
srm_register_protocol(p);
}
- srm_setup_protocols(&CP);
+ srm_setup_protocols(&connection_pool);
/******************************************************************************
** Main loop
*/
for (;;) {
- CP_RESET;
+ /* Clear the test_set for select() */
+ memcpy(&connection_pool.ready_set, &connection_pool.test_set, sizeof connection_pool.test_set);
timeout.tv_sec = 1;
timeout.tv_usec = 0;
- CP_SELECT(timeout);
+ select((connection_pool.max_fd) + 1, &connection_pool.ready_set, NULL, NULL, &timeout);
- for (fd = 0; fd <= CP.max_fd; fd++) {
- if ((CP.info[fd].status == SRM_STATUS_RENDEZVOUS) && CP_ISNEWCONNECT(fd)) {
- if (CP.info[fd].protocol->host.family == AF_UNIX) {
+ /* Walk through all rendezvous sockets looking for a new connection */
+ for (fd = 0; fd <= connection_pool.max_fd; fd++) {
+ if ((connection_pool.info[fd].status == SRM_STATUS_RENDEZVOUS) && FD_ISSET(fd, &connection_pool.ready_set)) {
+ if (connection_pool.info[fd].protocol->host.family == AF_UNIX) {
client_un_len = sizeof (client_un);
new_fd = accept (fd, (struct sockaddr *) &client_un, &client_un_len);
srm_fmt_message (LL_CONNECTION, "Connect", "%s", INI_SETTING(sockname));
- } else if (CP.info[fd].protocol->host.family == AF_INET) {
+ } else if (connection_pool.info[fd].protocol->host.family == AF_INET) {
client_in_len = sizeof (client_in);
new_fd = accept (fd, (struct sockaddr *) &client_in, &client_in_len);
iaddr = &client_in.sin_addr;
@@ -373,8 +375,8 @@
srm_cleanup_ini_settings();
/* Closing sockets */
- for (fd = 3; fd < CP.max_fd; fd++) {
- if (CP.info[fd].status != SRM_STATUS_NOT_USED) {
+ for (fd = 3; fd < connection_pool.max_fd; fd++) {
+ if (connection_pool.info[fd].status != SRM_STATUS_NOT_USED) {
close(fd);
}
}
[FILE: /srm/main/src/srm_protocols.h]
--- srm/main/src/srm_protocols.h:1.7 Sun Feb 23 19:22:32 2003 GMT
+++ srm/main/src/srm_protocols.h Sun Feb 23 19:29:08 2003 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.7 2003/02/23 20:22:32 derick Exp $ */
+/* $Id: cvstemp,v 1.8 2003/02/23 20:29:08 derick Exp $ */
/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
@@ -24,29 +24,6 @@
#define __PROTOCOLS_H__
#include "srm_value.h"
-
-#define CP connection_pool
-
-#define CP_RESET memcpy (&connection_pool.ready_set, \
- &connection_pool.test_set, sizeof connection_pool.test_set);
-
-#define CP_SELECT(to) select ((connection_pool.max_fd) + 1, \
- &connection_pool.ready_set, NULL, NULL, (&to));
-
-#define CP_ISNEWCONNECT(sock) FD_ISSET ((sock), &connection_pool.ready_set)
-
-#define CP_NEW_CONNECTION(fd,pfd) FD_SET ((fd), &connection_pool.test_set); \
- connection_pool.counter++; \
- connection_pool.info[fd].status = SRM_STATUS_NORMAL; \
- connection_pool.info[fd].fd_no = fd; \
- connection_pool.info[fd].protocol = connection_pool.info[pfd].protocol;
-
-#define CP_CONNECTION_AVAILABLE(fd) \
- FD_ISSET ((fd), &connection_pool.ready_set)
-
-#define CP_CLOSE_CONNECTION(fd) FD_CLR ((fd), &connection_pool.test_set); \
- connection_pool.info[fd].status = SRM_STATUS_NOT_USED; \
- close (fd)
extern struct con_pool connection_pool;
Received on Sun Feb 23 21:29:09 2003
This archive was generated by hypermail 2.1.8 : Tue Jan 06 2009 - 10:00:04 CET