Find the current size of SO_SNDBUF. A value of 0 means either an error
occured or no hosts were available. It is safe to assume system default
-if this occurs.
+if this occurs. If an error occurs you can checked the last cached errno statement to find the specific error.
=item MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
Find the current size of SO_RCVBUF. A value of 0 means either an error
occured or no hosts were available. It is safe to assume system default
-if this occurs.
+if this occurs. If an error occurs you can checked the last cached errno statement to find the specific error.
=item MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
/* REFACTOR */
/* We just try the first host, and if it is down we return zero */
if ((memcached_connect(instance)) != MEMCACHED_SUCCESS)
+ {
+ return 0;
+ }
+
+ if (memcached_io_wait_for_write(instance) != MEMCACHED_SUCCESS)
+ {
return 0;
+ }
- if (getsockopt(instance->fd, SOL_SOCKET,
- SO_SNDBUF, &sock_size, &sock_length))
+ if (getsockopt(instance->fd, SOL_SOCKET, SO_SNDBUF, &sock_size, &sock_length) < 0)
+ {
+ ptr->cached_errno= errno;
return 0; /* Zero means error */
+ }
}
return (uint64_t) sock_size;
{
/* We just try the first host, and if it is down we return zero */
if ((memcached_connect(instance)) != MEMCACHED_SUCCESS)
+ {
+ return 0;
+ }
+
+ if (memcached_io_wait_for_write(instance) != MEMCACHED_SUCCESS)
+ {
return 0;
+ }
- if (getsockopt(instance->fd, SOL_SOCKET,
- SO_RCVBUF, &sock_size, &sock_length))
+ if (getsockopt(instance->fd, SOL_SOCKET, SO_RCVBUF, &sock_size, &sock_length) < 0)
+ {
+ ptr->cached_errno= errno;
return 0; /* Zero means error */
+ }
}
return MEMCACHED_FAILURE;
}
+memcached_return_t memcached_io_wait_for_write(memcached_server_write_instance_st ptr)
+{
+ return io_wait(ptr, MEM_WRITE);
+}
+
/**
* Try to fill the input buffer for a server with as much
* data as possible.
const void *buffer;
};
+LIBMEMCACHED_LOCAL
+memcached_return_t memcached_io_wait_for_write(memcached_server_write_instance_st ptr);
+
LIBMEMCACHED_LOCAL
ssize_t memcached_io_writev(memcached_server_write_instance_st ptr,
const struct libmemcached_io_vector_st *vector,