]> code.citadel.org Git - citadel.git/commitdiff
* Client connectsock() is now TCP only
authorArt Cancro <ajc@citadel.org>
Thu, 19 Aug 2010 16:41:34 +0000 (16:41 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 19 Aug 2010 16:41:34 +0000 (16:41 +0000)
citadel/utillib/citadel_ipc.c

index bfef117d5582d6a6ab3ff1912a37eafdcd968939..016207aa2adfb8030f43d6a7a405780d855c125d 100644 (file)
@@ -2613,7 +2613,7 @@ int CtdlIPCGenericCommand(CtdlIPC *ipc,
 }
 
 
-static int connectsock(char *host, char *service, char *protocol, int defaultPort)
+static int tcp_connectsock(char *host, char *service, int defaultPort)
 {
        struct hostent *phe;
        struct servent *pse;
@@ -2624,7 +2624,7 @@ static int connectsock(char *host, char *service, char *protocol, int defaultPor
        memset(&sin, 0, sizeof(sin));
        sin.sin_family = AF_INET;
 
-       pse = getservbyname(service, protocol);
+       pse = getservbyname(service, "tcp");
        if (pse != NULL) {
                sin.sin_port = pse->s_port;
        }
@@ -2640,14 +2640,10 @@ static int connectsock(char *host, char *service, char *protocol, int defaultPor
        } else if ((sin.sin_addr.s_addr = inet_addr(host)) == INADDR_NONE) {
                return -1;
        }
-       if ((ppe = getprotobyname(protocol)) == 0) {
+       if ((ppe = getprotobyname("tcp")) == 0) {
                return -1;
        }
-       if (!strcmp(protocol, "udp")) {
-               type = SOCK_DGRAM;
-       } else {
-               type = SOCK_STREAM;
-       }
+       type = SOCK_STREAM;
 
        s = socket(PF_INET, type, ppe->p_proto);
        if (s < 0) {
@@ -3242,7 +3238,7 @@ CtdlIPC* CtdlIPC_new(int argc, char **argv, char *hostbuf, char *portbuf)
                return ipc;
        }
 
-       ipc->sock = connectsock(cithost, citport, "tcp", 504);
+       ipc->sock = tcp_connectsock(cithost, citport, 504);
        if (ipc->sock == -1) {
                ifree(ipc);
                return 0;