int local_errno= get_socket_errno(); // We cache in case closesocket() modifies errno
switch (local_errno)
{
-#ifdef TARGET_OS_LINUX
+#ifdef __linux__
case ERESTART:
#endif
case EINTR:
default: // This should not happen
break;
-#if 0
- if (fds[0].revents & POLLERR)
- {
- int err;
- socklen_t len= sizeof(err);
- if (getsockopt(server->fd, SOL_SOCKET, SO_ERROR, (char*)&err, &len) == 0)
- {
- if (err == 0)
- {
- // This should never happen, if it does? Punt.
- continue;
- }
- local_errno= err;
- }
- }
-#endif
}
assert_msg(server->fd != INVALID_SOCKET, "poll() was passed an invalid file descriptor");
}
}
- return memcached_set_error(*server, MEMCACHED_TIMEOUT, MEMCACHED_AT);
+ return memcached_set_error(*server, MEMCACHED_TIMEOUT, MEMCACHED_AT, memcached_literal_param("(number_of == 0)"));
}
-#if 0
- server->revents(fds[0].revents);
-#endif
-
assert (number_of == 1);
if (fds[0].revents & POLLERR or
if (timeout_error_occured and server->state < MEMCACHED_SERVER_STATE_IN_PROGRESS)
{
- return memcached_set_error(*server, MEMCACHED_TIMEOUT, MEMCACHED_AT);
+ return memcached_set_error(*server, MEMCACHED_TIMEOUT, MEMCACHED_AT,
+ memcached_literal_param("if (timeout_error_occured and server->state < MEMCACHED_SERVER_STATE_IN_PROGRESS)"));
}
return memcached_set_error(*server, MEMCACHED_CONNECTION_FAILURE, MEMCACHED_AT); /* The last error should be from connect() */
if (instance->root->poll_timeout == 0) // Mimic 0 causes timeout behavior (not all platforms do this)
{
- return memcached_set_error(*instance, MEMCACHED_TIMEOUT, MEMCACHED_AT);
+ return memcached_set_error(*instance, MEMCACHED_TIMEOUT, MEMCACHED_AT, memcached_literal_param("poll_timeout() was set to zero"));
}
size_t loop_max= 5;
if (active_fd == 0)
{
- return memcached_set_error(*instance, MEMCACHED_TIMEOUT, MEMCACHED_AT);
+ return memcached_set_error(*instance, MEMCACHED_TIMEOUT, MEMCACHED_AT, memcached_literal_param("No active_fd were found"));
}
// Only an error should result in this code being called.
}
break;
+ case PROTOCOL_BINARY_CMD_TOUCH:
+ {
+ rc= MEMCACHED_SUCCESS;
+ if (bodylen == 4) // The four byte read is a bug?
+ {
+ char touch_buffer[4]; // @todo document this number
+ rc= memcached_safe_read(instance, touch_buffer, sizeof(touch_buffer));
+#if 0
+ fprintf(stderr, "%s:%d %d %d %d %d %.*s(%d)\n", __FILE__, __LINE__,
+ int(touch_buffer[0]),
+ int(touch_buffer[1]),
+ int(touch_buffer[2]),
+ int(touch_buffer[3]),
+ int(bodylen), touch_buffer, int(bodylen));
+#endif
+ }
+ return memcached_set_error(*instance, rc, MEMCACHED_AT);
+ }
+
case PROTOCOL_BINARY_CMD_FLUSH:
case PROTOCOL_BINARY_CMD_QUIT:
case PROTOCOL_BINARY_CMD_SET:
case PROTOCOL_BINARY_CMD_APPEND:
case PROTOCOL_BINARY_CMD_PREPEND:
case PROTOCOL_BINARY_CMD_DELETE:
- case PROTOCOL_BINARY_CMD_TOUCH:
{
- if (bodylen != 0)
- {
- char touch_buffer[32]; // @todo document this number
- rc= memcached_safe_read(instance, buffer, sizeof(touch_buffer));
- }
- return memcached_set_error(*instance, rc, MEMCACHED_AT);
+ WATCHPOINT_ASSERT(bodylen == 0);
+ return MEMCACHED_SUCCESS;
}
case PROTOCOL_BINARY_CMD_NOOP:
free(value);
}
- test_compare(MEMCACHED_SUCCESS,
- memcached_touch(memc, test_literal_param(__func__), 60 *60));
+ rc= memcached_touch(memc, test_literal_param(__func__), 60 *60);
+ ASSERT_EQ_(MEMCACHED_SUCCESS, rc, "%s", memcached_last_error_message(memc));
rc= memcached_touch(memc, test_literal_param(__func__), 60 *60 *24 *60);
- test_compare(MEMCACHED_SUCCESS, rc);
+ ASSERT_EQ_(MEMCACHED_SUCCESS, rc, "%s", memcached_last_error_message(memc));
- test_compare(MEMCACHED_NOTFOUND,
- memcached_exist(memc, test_literal_param(__func__)));
+ rc= memcached_exist(memc, test_literal_param(__func__));
+ ASSERT_EQ_(MEMCACHED_NOTFOUND, rc, "%s", memcached_last_error_message(memc));
return TEST_SUCCESS;
}
free(value);
}
- test_compare(MEMCACHED_SUCCESS,
- memcached_touch_by_key(memc,
- test_literal_param("grouping_key"),
- test_literal_param(__func__),
- 60 *60));
+ rc= memcached_touch_by_key(memc,
+ test_literal_param("grouping_key"),
+ test_literal_param(__func__),
+ 60 *60);
+ ASSERT_EQ_(MEMCACHED_SUCCESS, rc, "%s", memcached_last_error_message(memc));
- test_compare(MEMCACHED_SUCCESS,
- memcached_touch_by_key(memc,
- test_literal_param("grouping_key"),
- test_literal_param(__func__),
- 60 *60 *24 *60));
- test_compare(MEMCACHED_NOTFOUND,
- memcached_exist_by_key(memc, test_literal_param("grouping_key"),test_literal_param(__func__)));
+ rc= memcached_touch_by_key(memc,
+ test_literal_param("grouping_key"),
+ test_literal_param(__func__),
+ 60 *60 *24 *60);
+ ASSERT_EQ_(MEMCACHED_SUCCESS, rc, "%s", memcached_last_error_message(memc));
+
+ rc= memcached_exist_by_key(memc, test_literal_param("grouping_key"),test_literal_param(__func__));
+ ASSERT_EQ_(MEMCACHED_NOTFOUND, rc, "%s", memcached_last_error_message(memc));
return TEST_SUCCESS;
}