projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Created a bigger buffer for write/read.
[awesomized/libmemcached]
/
lib
/
memcached_connect.c
diff --git
a/lib/memcached_connect.c
b/lib/memcached_connect.c
index f95b8e7d752f3115298cf85310b63c1d93a9bb69..57274be2086a17d35192dd98bd68c54716de2507 100644
(file)
--- a/
lib/memcached_connect.c
+++ b/
lib/memcached_connect.c
@@
-4,6
+4,7
@@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
+#include <netdb.h>
memcached_return memcached_real_connect(memcached_st *ptr, unsigned int server_key)
{
memcached_return memcached_real_connect(memcached_st *ptr, unsigned int server_key)
{
@@
-12,8
+13,14
@@
memcached_return memcached_real_connect(memcached_st *ptr, unsigned int server_k
if (ptr->hosts[server_key].fd == -1)
{
if (ptr->hosts[server_key].fd == -1)
{
+ /* Old connection junk still is in the structure */
+ assert(ptr->hosts[server_key].stack_responses == 0);
+
if ((h= gethostbyname(ptr->hosts[server_key].hostname)) == NULL)
if ((h= gethostbyname(ptr->hosts[server_key].hostname)) == NULL)
+ {
+ ptr->my_errno= h_errno;
return MEMCACHED_HOST_LOCKUP_FAILURE;
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);
servAddr.sin_family= h->h_addrtype;
memcpy((char *) &servAddr.sin_addr.s_addr, h->h_addr_list[0], h->h_length);
@@
-56,6
+63,7
@@
test_connect:
{
switch (errno) {
/* We are spinning waiting on connect */
{
switch (errno) {
/* We are spinning waiting on connect */
+ case EALREADY:
case EINPROGRESS:
case EINTR:
goto test_connect;
case EINPROGRESS:
case EINTR:
goto test_connect;
@@
-63,10
+71,11
@@
test_connect:
break;
default:
ptr->my_errno= errno;
break;
default:
ptr->my_errno= errno;
- return MEMCACHED_
HOST_LOCKUP_FAILURE
;
+ return MEMCACHED_
ERRNO
;
}
ptr->connected++;
}
}
ptr->connected++;
}
+ assert(ptr->hosts[server_key].stack_responses == 0);
}
return MEMCACHED_SUCCESS;
}
return MEMCACHED_SUCCESS;