]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/conn.c
Refactoring: Rename CONNECTION.res_stat to .proc_stat
[ngircd-alex.git] / src / ngircd / conn.c
index 4367754061ab7779423af62dcefcc66f25b9a649..91ff779677c969ec9b8ee299de386cd75f606097 100644 (file)
@@ -21,9 +21,9 @@
 #include "imp.h"
 #include <assert.h>
 #ifdef PROTOTYPES
-#      include <stdarg.h>
+# include <stdarg.h>
 #else
-#      include <varargs.h>
+# include <varargs.h>
 #endif
 #include <stdio.h>
 #include <stdlib.h>
 
 #include "array.h"
 #include "defines.h"
-#include "resolve.h"
 
 #include "exp.h"
 #include "conn.h"
 
 #include "imp.h"
 #include "ngircd.h"
+#include "array.h"
 #include "client.h"
 #include "conf.h"
 #include "conn-ssl.h"
 #include "conn-zip.h"
 #include "conn-func.h"
 #include "log.h"
+#include "ng_ipaddr.h"
 #include "parse.h"
+#include "proc.h"
+#include "resolve.h"
 #include "tool.h"
 
 #ifdef ZEROCONF
@@ -342,7 +345,7 @@ cb_clientserver_ssl(int sock, short what)
        case 0:
                return; /* EAGAIN: callback will be invoked again by IO layer */
        default:
-               Conn_Close(idx, "Socket closed!", "SSL accept error", false);
+               Conn_Close(idx, "SSL accept error, closing socket", "SSL accept error", false);
                return;
        }
        if (what & IO_WANTREAD)
@@ -752,7 +755,7 @@ Conn_Handler(void)
                        if (SSL_WantWrite(&My_Connections[i]))
                                continue; /* TLS/SSL layer needs to write data; deal with this first */
 #endif
-                       if (Resolve_INPROGRESS(&My_Connections[i].res_stat)) {
+                       if (Proc_InProgress(&My_Connections[i].proc_stat)) {
                                /* Wait for completion of resolver sub-process ... */
                                io_event_del(My_Connections[i].sock,
                                             IO_WANTREAD);
@@ -809,12 +812,12 @@ Conn_Handler(void)
  */
 #ifdef PROTOTYPES
 GLOBAL bool
-Conn_WriteStr( CONN_ID Idx, char *Format, ... )
+Conn_WriteStr(CONN_ID Idx, const char *Format, ...)
 #else
 GLOBAL bool 
-Conn_WriteStr( Idx, Format, va_alist )
+Conn_WriteStr(Idx, Format, va_alist)
 CONN_ID Idx;
-char *Format;
+const char *Format;
 va_dcl
 #endif
 {
@@ -1071,8 +1074,8 @@ Conn_Close( CONN_ID Idx, const char *LogMsg, const char *FwdMsg, bool InformClie
        }
 
        /* cancel running resolver */
-       if (Resolve_INPROGRESS(&My_Connections[Idx].res_stat))
-               Resolve_Shutdown(&My_Connections[Idx].res_stat);
+       if (Proc_InProgress(&My_Connections[Idx].proc_stat))
+               Proc_Kill(&My_Connections[Idx].proc_stat);
 
        /* Servers: Modify time of next connect attempt? */
        Conf_UnsetServer( Idx );
@@ -1374,7 +1377,7 @@ New_Connection(int Sock)
                identsock = -1;
 #endif
        if (!Conf_NoDNS)
-               Resolve_Addr(&My_Connections[new_sock].res_stat, &new_addr,
+               Resolve_Addr(&My_Connections[new_sock].proc_stat, &new_addr,
                             identsock, cb_Read_Resolver_Result);
 
        /* ngIRCd waits up to 4 seconds for the result of the asynchronous
@@ -1763,7 +1766,7 @@ Check_Servers( void )
                /* Okay, try to connect now */
                Conf_Server[i].lasttry = time_now;
                Conf_Server[i].conn_id = SERVER_WAIT;
-               assert(Resolve_Getfd(&Conf_Server[i].res_stat) < 0);
+               assert(Proc_GetPipeFd(&Conf_Server[i].res_stat) < 0);
                Resolve_Name(&Conf_Server[i].res_stat, Conf_Server[i].host, cb_Connect_to_Server);
        }
 } /* Check_Servers */
@@ -1886,7 +1889,7 @@ Init_Conn_Struct(CONN_ID Idx)
        My_Connections[Idx].signon = now;
        My_Connections[Idx].lastdata = now;
        My_Connections[Idx].lastprivmsg = now;
-       Resolve_Init(&My_Connections[Idx].res_stat);
+       Proc_InitStruct(&My_Connections[Idx].proc_stat);
 } /* Init_Conn_Struct */
 
 
@@ -1941,7 +1944,7 @@ cb_Connect_to_Server(int fd, UNUSED short events)
        LogDebug("Resolver: Got forward lookup callback on fd %d, events %d", fd, events);
 
        for (i=0; i < MAX_SERVERS; i++) {
-                 if (Resolve_Getfd(&Conf_Server[i].res_stat) == fd )
+                 if (Proc_GetPipeFd(&Conf_Server[i].res_stat) == fd )
                          break;
        }
 
@@ -2000,7 +2003,7 @@ cb_Read_Resolver_Result( int r_fd, UNUSED short events )
        /* Search associated connection ... */
        for( i = 0; i < Pool_Size; i++ ) {
                if(( My_Connections[i].sock != NONE )
-                 && ( Resolve_Getfd(&My_Connections[i].res_stat) == r_fd ))
+                 && (Proc_GetPipeFd(&My_Connections[i].proc_stat) == r_fd))
                        break;
        }
        if( i >= Pool_Size ) {
@@ -2012,7 +2015,7 @@ cb_Read_Resolver_Result( int r_fd, UNUSED short events )
        }
 
        /* Read result from pipe */
-       len = Resolve_Read(&My_Connections[i].res_stat, readbuf, sizeof readbuf -1);
+       len = Resolve_Read(&My_Connections[i].proc_stat, readbuf, sizeof readbuf -1);
        if (len == 0)
                return;