X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fmemcached_connect.c;h=a0c8737c31df48e6e6b7b98e5549d06344408e42;hb=dd3711e0fb5dc8ea96253ca28db3d1fe3067a920;hp=d015c68a2ccf7b42c1d5f05411733afa99d6f001;hpb=ca065f55235fd9979ede818963780f417d70c64e;p=m6w6%2Flibmemcached diff --git a/lib/memcached_connect.c b/lib/memcached_connect.c index d015c68a..a0c8737c 100644 --- a/lib/memcached_connect.c +++ b/lib/memcached_connect.c @@ -26,7 +26,6 @@ memcached_return memcached_connect(memcached_st *ptr) unsigned int x; struct sockaddr_in localAddr, servAddr; struct hostent *h; - memcached_host_st *host_ptr; if (ptr->connected) return MEMCACHED_SUCCESS; @@ -44,10 +43,7 @@ memcached_return memcached_connect(memcached_st *ptr) for (x= 0; x < ptr->number_of_hosts; x++) { if ((h= gethostbyname(ptr->hosts[x].hostname)) == NULL) - { - fprintf(stderr, "unknown host '%s'\n", ptr->hosts[x].hostname); return MEMCACHED_HOST_LOCKUP_FAILURE; - } servAddr.sin_family= h->h_addrtype; memcpy((char *) &servAddr.sin_addr.s_addr, h->h_addr_list[0], h->h_length); @@ -55,10 +51,7 @@ memcached_return memcached_connect(memcached_st *ptr) /* Create the socket */ if ((ptr->hosts[0].fd= socket(AF_INET, SOCK_STREAM, 0)) < 0) - { - fprintf(stderr, "cannot open socket"); return MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE; - } /* bind any port number */ @@ -67,19 +60,11 @@ memcached_return memcached_connect(memcached_st *ptr) localAddr.sin_port = htons(0); if (bind(ptr->hosts[0].fd, (struct sockaddr *) &localAddr, sizeof(localAddr)) < 0) - { - fprintf(stderr, "cannot bind port TCP %u\n", ptr->hosts[x].port); return(MEMCACHED_CONNECTION_BIND_FAILURE); - } /* connect to server */ if (connect(ptr->hosts[0].fd, (struct sockaddr *) &servAddr, sizeof(servAddr)) < 0) - { - fprintf(stderr, "cannot connect to host '%s' (%u) (error: %s)\n", ptr->hosts[x].hostname, - ptr->hosts[x].port, - strerror(errno)); return MEMCACHED_HOST_LOCKUP_FAILURE; - } } ptr->connected= 1;