[-]
[+]
|
Changed |
libmemcached.spec
|
|
[-]
[+]
|
Deleted |
libmemcached-0.38.tar.bz2/m4/bitfield.m4
^
|
@@ -1,51 +0,0 @@
-AC_DEFUN([DETECT_BITFIELD],
-[
- AC_CACHE_CHECK([for working bitfield],[ac_cv_have_bitfield],[
- AC_LANG_PUSH([C])
- save_CFLAGS="${CFLAGS}"
- CFLAGS="${AM_CFLAGS} ${NO_WERROR}"
-
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([[
-#include <stdbool.h>
- ]],[[
- struct flags { bool b0:1; bool b1:1; bool b2:1; bool b3:1;
- bool b4:1; bool b5:1; bool b6:1; bool b7:1;
- } f = { .b0 = false, .b1 = false, .b2 = false, .b3 = false,
- .b4 = false, .b5 = false, .b6 = false, .b7 = false };
-
- f.b0 = true;
- f.b1 = false;
- f.b2 = true;
- f.b3 = false;
- f.b4 = true;
- f.b5 = false;
- f.b6 = true;
- f.b7 = false;
-
- if (f.b0 && !f.b1 && f.b2 && !f.b3 && f.b4 && !f.b5 && f.b6 && !f.b7) {
- return 0;
- }
-
- return 1;
- ]])
- ], [
- ac_cv_have_bitfield=yes
- ],[
- ac_cv_have_bitfield=no
- ])])
-
- CFLAGS=${save_CFLAGS}
- AS_IF([test "x$ac_cv_have_bitfield" = "xyes"],
- [
- MEMCACHED_BITFIELD="#define MEMCACHED_BITFIELD :1"
- HASHKIT_BITFIELD="#define HASHKIT_BITFIELD :1"
- ],
- [
- MEMCACHED_BITFIELD="#define MEMCACHED_BITFIELD"
- HASHKIT_BITFIELD="#define HASHKIT_BITFIELD"
- ])
- AC_SUBST([MEMCACHED_BITFIELD])
- AC_SUBST([HASHKIT_BITFIELD])
- AC_LANG_POP()
-])
|
|
Deleted |
libmemcached-0.39.tar.bz2
^
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/ChangeLog
^
|
@@ -1,347 +1,332 @@
+0.40 Thu Apr 22 19:01:25 PDT 2010
+ * Placed retry logic in for busted resolvers
+ * Add an ignore for SIGPIPE to solve OSX issues.
+ * A couple of fixed for memcached_light server.
+ * Updated to debug mode to track io_wait
+
+0.39 Tue Apr 6 12:35:13 PDT 2010
+ * Add support for prefix keys to binary protocol.
+ * Remove the undocumented call memcached_server_remove().
+ * The undocumented call memcached_server_by_key() now returns const.
+ * memcached_server_error_reset() has been deprecated.
+ * memcached_server_list() has been deprecated. Use memcached_server_cursor() to walk the servers found in a memcached_st() structure.
+ * memcached_verbosity() can now be run concurrently with other operations.
+ * SASL support.
+ * Fixes memory leak found in EJECT HOSTS.
+
0.38 Wed Feb 10 09:40:33 PST 2010
-* C++ interface for libhashkit.
-* Modified memcached_set_memory_allocators() so that it requires a context pointer.
-* memcached_clone() now runs 5 times faster.
-* Functions used for callbacks are now given const memcached_st.
-* Added MEMCACHED_BEHAVIOR_CORK.
-* memslap now creates a configuration file at ~/.memslap.cnf
-* memcached_purge() now calls any callbacks registered during get execution.
-* Many fixes to memslap.
-* Updates for memcapable.
-* Compile fixes for OpenBSD.
-* Fix for possible recursive decent on IO failure.
+ * C++ interface for libhashkit.
+ * Modified memcached_set_memory_allocators() so that it requires a context pointer.
+ * memcached_clone() now runs 5 times faster.
+ * Functions used for callbacks are now given const memcached_st.
+ * Added MEMCACHED_BEHAVIOR_CORK.
+ * memslap now creates a configuration file at ~/.memslap.cnf
+ * memcached_purge() now calls any callbacks registered during get execution.
+ * Many fixes to memslap.
+ * Updates for memcapable.
+ * Compile fixes for OpenBSD.
+ * Fix for possible recursive decent on IO failure.
0.37 Mon Jan 11 16:29:57 PST 2010
-* Fixed build for libhashkit.
-* Fixed install path regression.
-* Modified RPM to strict check install.
-* Added documentation for memcached_server_cursor();
-* Added memcached_servers_reset().
-* Modified memcached_st to remove dead cursor_server member.
+ * Fixed build for libhashkit.
+ * Fixed install path regression.
+ * Modified RPM to strict check install.
+ * Added documentation for memcached_server_cursor();
+ * Added memcached_servers_reset().
+ * Modified memcached_st to remove dead cursor_server member.
0.36 Wed Jan 6 18:23:50 PST 2010
-* Merged in new memslap utility.
-* All of constants.h has been updated to match style (all old identifiers continue to work).
-* Added first pass for libhashkit.
-* Updated test Framework/extended tests.
-* Random read support during replication added.
-* Modified use_sort so that the option can be applied to any distribution type.
-* We removed the MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE added in 0.35. Instead use memcached_behavior_set_distribution().
+ * Merged in new memslap utility.
+ * All of constants.h has been updated to match style (all old identifiers continue to work).
+ * Added first pass for libhashkit.
+ * Updated test Framework/extended tests.
+ * Random read support during replication added.
+ * Modified use_sort so that the option can be applied to any distribution type.
+ * We removed the MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE added in 0.35. Instead use memcached_behavior_set_distribution().
0.35 Mon Nov 9 11:18:33 PST 2009
-* Added support for by_key operations for inc/dec methods.
-* Added mget test to memslap.
-* Support for compatible ketama for SpyMemcached
-* Update C++ interface.
-* Fix for memcp
+ * Added support for by_key operations for inc/dec methods.
+ * Added mget test to memslap.
+ * Support for compatible ketama for SpyMemcached
+ * Update C++ interface.
+ * Fix for memcp
0.34 Tue Oct 13 08:39:51 PDT 2009
-* Added support for setting behavior flags on a connection pool.
-* Don't increment server_failure_counter on normal disconnects.
-* Added prototype for a callback based protocol parser (server side) with examples so that you could let your own application speak the memcached protocol
-* Updated memcapable to test ASCII protocol.
-* Changed behavior so that server can be removed at first sign of failure.
-* Added memcached_server_get_last_disconnect() call
+ * Added support for setting behavior flags on a connection pool.
+ * Don't increment server_failure_counter on normal disconnects.
+ * Added prototype for a callback based protocol parser (server side) with examples so that you could let your own application speak the memcached protocol
+ * Updated memcapable to test ASCII protocol.
+ * Changed behavior so that server can be removed at first sign of failure.
+ * Added memcached_server_get_last_disconnect() call
0.33 Wed Sep 23 10:11:58 PDT 2009
-* Added memcapable to test servers for binary compatibility.
-* Updated C++ interface. Added basic support for C++ exceptions. Added
-multiple constructors the memcached client object. The C++ interface
-now takes parameters which are C++ types (such as std::string).
-* Several bug fixes for binary protocol support.
-* Fixed crashing issue with dumping from memcachd server (server internals were changed without documenting change).
+ * Added memcapable to test servers for binary compatibility.
+ * Updated C++ interface. Added basic support for C++ exceptions. Added multiple constructors the memcached client object. The C++ interface now takes parameters which are C++ types (such as std::string).
+ * Several bug fixes for binary protocol support.
+ * Fixed crashing issue with dumping from memcachd server (server internals were changed without documenting change).
0.32 Tue Sep 15 15:49:09 PDT 2009
-* Change of behavior where linger is only modified for no-block and then
-it is set to zero.
-* Added Twitter's memcached_server_error() functions.
-* Fix for OSX compiles in development builds.
-* Updated C++ interface.
-* Updated memcached_mget and memcached_mget_by_key to take a size_t
-as a parameter instead of an unsigned int for number_of_keys.
+ * Change of behavior where linger is only modified for no-block and then it is set to zero.
+ * Added Twitter's memcached_server_error() functions.
+ * Fix for OSX compiles in development builds.
+ * Updated C++ interface.
+ * Updated memcached_mget and memcached_mget_by_key to take a size_t as a parameter instead of an unsigned int for number_of_keys.
0.31 Fri Jul 10 09:02:50 PDT 2009
-* Added support or HA via replication.
-* malloc() removed for server key usage.
-* Update build system.
-* Added support for memcached_set_memory_allocators().
-* Fixed bug in configure.ac for have_htoll.
+ * Added support or HA via replication.
+ * malloc() removed for server key usage.
+ * Update build system.
+ * Added support for memcached_set_memory_allocators().
+ * Fixed bug in configure.ac for have_htoll.
0.30 Sun May 31 17:31:52 PDT 2009
-* Added memcachd_dump command (and framework for memdump tool).
-* Realigned all structures to remove padding (and line up important bits for 64bit caches.
-* Remove some of sprintf() in storage calls().
-* Removed printf() in stat call for unknown stat member.
-* memcached_generate_hash() function added.
-* Added tests to make sure all hash functions are stable.
+ * Added memcachd_dump command (and framework for memdump tool).
+ * Realigned all structures to remove padding (and line up important bits for 64bit caches.
+ * Remove some of sprintf() in storage calls().
+ * Removed printf() in stat call for unknown stat member.
+ * memcached_generate_hash() function added.
+ * Added tests to make sure all hash functions are stable.
0.29 Tue May 19 08:26:48 PDT 2009
-* Fixed malloc usage to calloc for spots where we need zero filled memory.
-* All code warnings now treated as errors.
-* Fixes for debian packaging.
-* Added new pooling mechanism.
-* MEMCACHED_BEHAVIOR_NO_BLOCK no longer also sets MEMCACHED_BEHAVIOR_BUFFER_REQUESTS.
-* Updated generic rpm.
+ * Fixed malloc usage to calloc for spots where we need zero filled memory.
+ * All code warnings now treated as errors.
+ * Fixes for debian packaging.
+ * Added new pooling mechanism.
+ * MEMCACHED_BEHAVIOR_NO_BLOCK no longer also sets MEMCACHED_BEHAVIOR_BUFFER_REQUESTS.
+ * Updated generic rpm.
0.28 Tue Apr 14 18:56:28 PDT 2009
-* Fixed bug in init sructure (reapplied)
-* Fixed bug in get/set by key (nikkhils@gmail.com)
+ * Fixed bug in init sructure (reapplied)
+ * Fixed bug in get/set by key (nikkhils@gmail.com)
0.27 Sun Mar 29 22:33:01 PDT 2009
-* Added new UDP fire-forget mode.
-* Reworked performance for mget() to better make use of async protocol
-* Cleaned up execution of fetch (just one set of code now)
-* Fixed Jenkin's for big endian hosts.
-* Updates for memstat to determine network latency.
-* Updates for binary protocol.
-* Many updates to documentation.
+ * Added new UDP fire-forget mode.
+ * Reworked performance for mget() to better make use of async protocol
+ * Cleaned up execution of fetch (just one set of code now)
+ * Fixed Jenkin's for big endian hosts.
+ * Updates for memstat to determine network latency.
+ * Updates for binary protocol.
+ * Many updates to documentation.
0.26 Thu Jan 29 13:05:50 PST 2009
-* Fix for decrement on hash key
-* Fixed assert that was catching bad memset() call in host_reset()
-* Fix purge issue for blocked IO which has been stacked.
+ * Fix for decrement on hash key
+ * Fixed assert that was catching bad memset() call in host_reset()
+ * Fix purge issue for blocked IO which has been stacked.
0.25 Fri Nov 28 09:59:35 PST 2008
-* Jenkins HASH added.
-* Update of Murmur hash code
-* Support explicit weights (Robey Pointer, Evan Weaver)
-* Bugfix for ketama continuum (Robey Pointer)
-* New behavior MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY (Robey Pointer)
-* Don't ever call stats for weighting servers, because it is unstable.
+ * Jenkins HASH added.
+ * Update of Murmur hash code
+ * Support explicit weights (Robey Pointer, Evan Weaver)
+ * Bugfix for ketama continuum (Robey Pointer)
+ * New behavior MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY (Robey Pointer)
+ * Don't ever call stats for weighting servers, because it is unstable.
0.24 Tue Sep 16 02:59:03 PDT 2008 (never released)
-* Cleanup compile warnings.
-* Fix issues in partitioning by keys.
-* Fixed "fail case" to make sure when calling memcached_clone() no
-memcached_st is over written.
-* New memcached_server_by_key() method for finding a server from
-a key.
-* memcached_server_free() was added for freeing server structures.
+ * Cleanup compile warnings.
+ * Fix issues in partitioning by keys.
+ * Fixed "fail case" to make sure when calling memcached_clone() no memcached_st is over written.
+ * New memcached_server_by_key() method for finding a server from a key.
+ * memcached_server_free() was added for freeing server structures.
0.23 Sun Sep 7 08:13:59 PDT 2008
-* Added strings.h header for Solaris 9
-* Solaris 64bit fix.
-* Support for weighted Ketama from Yin Chen.
-* Fix for Chinese
-* Fix for 0 length key to trigger bad key.
-* Added behaviors MEMCACHED_BEHAVIOR_SND_TIMEOUT, MEMCACHED_BEHAVIOR_RCV_TIMEOUT
-* Support for Binary Protocol added
+ * Added strings.h header for Solaris 9
+ * Solaris 64bit fix.
+ * Support for weighted Ketama from Yin Chen.
+ * Fix for Chinese
+ * Fix for 0 length key to trigger bad key.
+ * Added behaviors MEMCACHED_BEHAVIOR_SND_TIMEOUT, MEMCACHED_BEHAVIOR_RCV_TIMEOUT
+ * Support for Binary Protocol added
0.22 Mon Jul 14 09:24:11 PDT 2008
-* Fix where master key was no being checked for "bad key"
-* Fixed bugs in stats output (thread output was wrong)
-* Clarified MEMCACHED_BAD_KEY_PROVIDED is return for bad prefix key.
-* Found a bug in Flags return (Jacek Ostrowski)
-* Fixed issue with compiling on Visual Studio
+ * Fix where master key was no being checked for "bad key"
+ * Fixed bugs in stats output (thread output was wrong)
+ * Clarified MEMCACHED_BAD_KEY_PROVIDED is return for bad prefix key.
+ * Found a bug in Flags return (Jacek Ostrowski)
+ * Fixed issue with compiling on Visual Studio
0.21 Fri May 23 18:34:09 PDT 2008
-* Change of char * to const char * for all key based functions.
-* New MEMCACHED_CALLBACK_PREFIX_KEY added. You can now create domains for
-values.
-* Fixed bug introducd in last version on memcp
-* Fix for death of file io to call shutdown()
+ * Change of char * to const char * for all key based functions.
+ * New MEMCACHED_CALLBACK_PREFIX_KEY added. You can now create domains for values.
+ * Fixed bug introducd in last version on memcp
+ * Fix for death of file io to call shutdown()
0.20 Mon May 5 08:34:26 PDT 2008
-* New consistent distribution tests.
-* Found a memory leak when a server constantly fails.
-* Fix in watchpoint macro
-* Changed default timeout to 1 second for poll timeouts
-* Wheel uses less memory/dynamic allocation for size (no longer limited to 512 hosts by default.
-* memslap memory leak fix
-* Added Ketama distribution
-* Fix assert.h compile problem on CentOS
+ * New consistent distribution tests.
+ * Found a memory leak when a server constantly fails.
+ * Fix in watchpoint macro
+ * Changed default timeout to 1 second for poll timeouts
+ * Wheel uses less memory/dynamic allocation for size (no longer limited to 512 hosts by default.
+ * memslap memory leak fix
+ * Added Ketama distribution
+ * Fix assert.h compile problem on CentOS
0.19 Wed Apr 9 09:30:53 PDT 2008
-* Documentation fix in libmemcached.
-* Fixed bug where sort was always occuring on hosts
-* Logic fix in branch prediction (thanks Jay!)
-* Read through cached support.
-* Fixed for cas by key operation.
-* Fix for memcached_server_st list structures to have correct count.
-* Added callback MEMCACHED_CALLBACK_DELETE_TRIGGER
-* Removed function call in favor of macro (aka cut out some instructions)
+ * Documentation fix in libmemcached.
+ * Fixed bug where sort was always occuring on hosts
+ * Logic fix in branch prediction (thanks Jay!)
+ * Read through cached support.
+ * Fixed for cas by key operation.
+ * Fix for memcached_server_st list structures to have correct count.
+ * Added callback MEMCACHED_CALLBACK_DELETE_TRIGGER
+ * Removed function call in favor of macro (aka cut out some instructions)
0.18 Sun Mar 16 21:57:55 PDT 2008
-* Fix plus tests for non-zero value objects and flags.
-* MEMCACHED_HASH_MURMUR added for murmur algorithm provided.
-* MEMCACHED_BEHAVIOR_RETRY_TIMEOUT added to keep connecting from looping on timeout.
-* gcc branch prediction optimizations
-* Refactored entire tree to make include files cleaner
-* Fixed leaked socket.
+ * Fix plus tests for non-zero value objects and flags.
+ * MEMCACHED_HASH_MURMUR added for murmur algorithm provided.
+ * MEMCACHED_BEHAVIOR_RETRY_TIMEOUT added to keep connecting from looping on timeout.
+ * gcc branch prediction optimizations
+ * Refactored entire tree to make include files cleaner
+ * Fixed leaked socket.
0.17 Wed Feb 27 03:33:29 PST 2008
-* MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT added for connect timeout in
-non-block mode.
-* Incompatible change in memcached_behavior_set() api. We now use a
-uint64_t, instead of a pointer.
-* Fix for storage of values for zero.
-* memcached_server_cursor() function added to API for cycling through servers.
+ * MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT added for connect timeout in non-block mode.
+ * Incompatible change in memcached_behavior_set() api. We now use a uint64_t, instead of a pointer.
+ * Fix for storage of values for zero.
+ * memcached_server_cursor() function added to API for cycling through servers.
0.16 Mon Feb 18 00:30:25 PST 2008
-* Work on the UDP protocol
-* Added get_by_key, set_by_key tests for C++ API
-* Fix for limit_maxbytes to be 64bit in stats
-* Added Atom Smasher test (scale baby, scale!)
-* Servers are now sorted, meaning that servers are now ordered so that clients with the same lists, will have same distribution. (Idea from Ross McFarland). MEMCACHED_BEHAVIOR_SORT_HOSTS was added to enable this support.
-* Added MEMCACHED_BAD_KEY_PROVIDED error for auto, set, and get operations. MEMCACHED_BEHAVIOR_VERIFY_KEY was added to enable this feature.
-* More error messages on command line tools.
-* Fixed bugs in memcached_cas() operator.
-* Fix to loop through interfaces
+ * Work on the UDP protocol
+ * Added get_by_key, set_by_key tests for C++ API
+ * Fix for limit_maxbytes to be 64bit in stats
+ * Added Atom Smasher test (scale baby, scale!)
+ * Servers are now sorted, meaning that servers are now ordered so that clients with the same lists, will have same distribution. (Idea from Ross McFarland). MEMCACHED_BEHAVIOR_SORT_HOSTS was added to enable this support.
+ * Added MEMCACHED_BAD_KEY_PROVIDED error for auto, set, and get operations. MEMCACHED_BEHAVIOR_VERIFY_KEY was added to enable this feature.
+ * More error messages on command line tools.
+ * Fixed bugs in memcached_cas() operator.
+ * Fix to loop through interfaces
0.15 Tue Jan 29 14:55:44 PST 2008
-* More work on the C++ API.
-* Bug fixes around block corner cases.
-* Slight performance increase in both read() and write().
+ * More work on the C++ API.
+ * Bug fixes around block corner cases.
+ * Slight performance increase in both read() and write().
0.14 Tue Jan 22 06:21:49 PST 2008
-* For for bug found by Evan Weaver where increment() was not returning
-propper error of value was not found.
-* Fix for bad null pointer on flag by Toru Maesaka.
-* Refactor of all IO to just pass in the active server
-* Problem configuring (PKG_CHECK_MODULES) fixed by removal of "rpath" in
-support/libmemcached.pc.in (Thanks to Ross McFarland).
-* Added memcached_callback_get()/set()
-* First prototype of C++ interface
-* Updated docs for uint16_t changes in previous release
+ * For for bug found by Evan Weaver where increment() was not returning propper error of value was not found.
+ * Fix for bad null pointer on flag by Toru Maesaka.
+ * Refactor of all IO to just pass in the active server
+ * Problem configuring (PKG_CHECK_MODULES) fixed by removal of "rpath" in support/libmemcached.pc.in (Thanks to Ross McFarland).
+ * Added memcached_callback_get()/set()
+ * First prototype of C++ interface
+ * Updated docs for uint16_t changes in previous release
0.13 Sun Jan 13 06:51:50 PST 2008
-* MEMCACHED_BEHAVIOR_USER_DATA added to store user pointer.
-* Fix for failure to connect to invalidate socket.
-* Patch from Marc Rossi to add --hash option for memcp, memrm, and memcat.
-* Kevin's patch for fixing EOF issues during a read.
-* Toru Maesaka patch for stats mismatch
-* Fix for when CRC return 0
-* Fixed uint16_t issues around flags. Turns out the documentation on the
-protocol was wrong.
-* Lingering socket fixes for FreeBSD.
-* Patches from Kevin Dalley for FreeBSD 4.0
-* Added multi delete functions.
-* All get key returns have C style null termination
-* If memcached_server_list_append is passed NULLs instead of pointers it
-returns NULL.
-* Added memcached_fetch_execute() method
-* Found a bug where memcached_fetch() was not null terminating the result
-value.
-* memcached_behavior() now has the ability to set "buffering" so that
-data is not automatically flushed.
-* Behavior change, buffered commands now return MEMCACHED_BUFFERED
+ * MEMCACHED_BEHAVIOR_USER_DATA added to store user pointer.
+ * Fix for failure to connect to invalidate socket.
+ * Patch from Marc Rossi to add --hash option for memcp, memrm, and memcat.
+ * Kevin's patch for fixing EOF issues during a read.
+ * Toru Maesaka patch for stats mismatch
+ * Fix for when CRC return 0
+ * Fixed uint16_t issues around flags. Turns out the documentation on the protocol was wrong.
+ * Lingering socket fixes for FreeBSD.
+ * Patches from Kevin Dalley for FreeBSD 4.0
+ * Added multi delete functions.
+ * All get key returns have C style null termination
+ * If memcached_server_list_append is passed NULLs instead of pointers it returns NULL.
+ * Added memcached_fetch_execute() method
+ * Found a bug where memcached_fetch() was not null terminating the result value.
+ * memcached_behavior() now has the ability to set "buffering" so that data is not automatically flushed.
+ * Behavior change, buffered commands now return MEMCACHED_BUFFERED
0.12 Tue Dec 11 15:20:55 PST 2007
-* Updates for consistent hashing
-* IPV6 support
-* Static allocation for hostname (performance)
-* Fixed bug where in non-block mode all data might not have been sent on
-close().
-* Refactor of memcached_get() to use common code.
-* Change in value fetch, MEMCACHED_END is now returned when keys are no
-longer in the pipe.
-* Fixed bug where key could be out of range of characters
-* Added _by_key() methods to allow partitioning of values to particular
-servers.
-* MEMCACHED_DEFAILT_TIMEOUT is now set to a non -1 value.
-* Performance improvements in get operations.
+ * Updates for consistent hashing
+ * IPV6 support
+ * Static allocation for hostname (performance)
+ * Fixed bug where in non-block mode all data might not have been sent on close().
+ * Refactor of memcached_get() to use common code.
+ * Change in value fetch, MEMCACHED_END is now returned when keys are no longer in the pipe.
+ * Fixed bug where key could be out of range of characters
+ * Added _by_key() methods to allow partitioning of values to particular servers.
+ * MEMCACHED_DEFAILT_TIMEOUT is now set to a non -1 value.
+ * Performance improvements in get operations.
0.11 Mon Nov 26 01:05:52 PST 2007
-* Added option to memcache_behavior_set() so that poll() can be timed out.
-* Fixed memory leak in case of using memcached_fetch_result() where no
-value was returned.
-* Bug fixed in memcached_connect() which would cause servers that
-did not need to be enabled to be enabled (performance issue).
-* Rewrote bounds checking code for get calls.
-* "make test" now starts its own memcached servers.
-* Added Hseih hash (MEMCACHED_HASH_HSIEH), which is showing about 7%
-performance over standard hash.
+ * Added option to memcache_behavior_set() so that poll() can be timed out.
+ * Fixed memory leak in case of using memcached_fetch_result() where no value was returned.
+ * Bug fixed in memcached_connect() which would cause servers that did not need to be enabled to be enabled (performance issue).
+ * Rewrote bounds checking code for get calls.
+ * "make test" now starts its own memcached servers.
+ * Added Hseih hash (MEMCACHED_HASH_HSIEH), which is showing about 7% performance over standard hash.
0.10 Tue Nov 20 23:22:31 PST 2007
-* Added append binary test.
-* Added MEMCACHED_BEHAVIOR_CACHE_LOOKUPS behavior so that you can save on
-multiple DNS lookups.
-* Added CAS support, though this is optional and must be enabled during
-runtime.
-* Added the utility memerror to create human readable error strings
-from memcached errors (aka convert ints to strings)
-* Fixed type in MEMCACHED_HOST_LOOKUP_FAILURE
-* Fixed bug where hostname might not be null terminated
-* Moved to using gethostbyname_r() on Linux to solve thread safety issue
-* Added -rpath support for pkg-config
-* Documentation fix for hash setting using memcached_behavior_set()
+ * Added append binary test.
+ * Added MEMCACHED_BEHAVIOR_CACHE_LOOKUPS behavior so that you can save on multiple DNS lookups.
+ * Added CAS support, though this is optional and must be enabled during runtime.
+ * Added the utility memerror to create human readable error strings from memcached errors (aka convert ints to strings)
+ * Fixed type in MEMCACHED_HOST_LOOKUP_FAILURE
+ * Fixed bug where hostname might not be null terminated
+ * Moved to using gethostbyname_r() on Linux to solve thread safety issue
+ * Added -rpath support for pkg-config
+ * Documentation fix for hash setting using memcached_behavior_set()
0.9 Thu Nov 15 07:44:00 PST 2007
-* fix for when no servers are definied.
-* different buffers are now kept for different connections to
-speed up async efforts
-* Modified increment/decrement functions to return uint64_t values
-* Fixed bug in cases where zero length keys were provided
-* Thread cleanup issue in memslap
-* No hostname lookup on reconnect
-* Fix for flag settings (was doing hex by accident!)
-* Support for 1.2.4 server additions "prepend" and "append" added.
-* Added memcached_version()... not sure if I will make this public
-or not.
+ * fix for when no servers are definied.
+ * different buffers are now kept for different connections to speed up async efforts
+ * Modified increment/decrement functions to return uint64_t values
+ * Fixed bug in cases where zero length keys were provided
+ * Thread cleanup issue in memslap
+ * No hostname lookup on reconnect
+ * Fix for flag settings (was doing hex by accident!)
+ * Support for 1.2.4 server additions "prepend" and "append" added.
+ * Added memcached_version()... not sure if I will make this public or not.
0.8 Mon Nov 5 10:40:41 PST 2007
-* Adding support for CRC hash method
-* Adding support for UNIX sockets
-* Added additional HASHing methods of FNV1_64,FNV1A_64, FNV1_32, FNV1A_32
-* Added pkgconfig support (PKG_CHECK_MODULES)
-* Fixed conflict with defined type in MySQL
-* Added memcached_result_st structure and functions to manipulate it.
+ * Adding support for CRC hash method
+ * Adding support for UNIX sockets
+ * Added additional HASHing methods of FNV1_64,FNV1A_64, FNV1_32, FNV1A_32
+ * Added pkgconfig support (PKG_CHECK_MODULES)
+ * Fixed conflict with defined type in MySQL
+ * Added memcached_result_st structure and functions to manipulate it.
0.7 Tue Oct 30 09:24:05 PDT 2007
-* Poved to poll() from select()
-* Fixes in internal string class for allocation of large numbers of
-strings.
-* memcached_mget() function now sends keys as it parses them instead of
-building strings as it goes.
-* Propper flush now for making sure we get all IO sent even when in
-non-block mode.
-* Added --enable-debug rule for configure
-* All asserts() removed (hey this is going into production!)
+ * Poved to poll() from select()
+ * Fixes in internal string class for allocation of large numbers of strings.
+ * memcached_mget() function now sends keys as it parses them instead of building strings as it goes.
+ * Propper flush now for making sure we get all IO sent even when in non-block mode.
+ * Added --enable-debug rule for configure
+ * All asserts() removed (hey this is going into production!)
0.6 Wed Oct 17 08:41:35 PDT 2007
-* get value returns are now null terminated (request by Cal Heldenbrand)
-* Fixed connections for more hosts then two.
-* Rewrite of the read/write IO systems to handle different sorts of host
-failures.
-* Added man pages for all functions and tools
-* Raised buffer size for readinng/writing to 16K
-* You can now optionally set the socket size for recv/send via
-memached_behavior_set/get.
+ * get value returns are now null terminated (request by Cal Heldenbrand)
+ * Fixed connections for more hosts then two.
+ * Rewrite of the read/write IO systems to handle different sorts of host failures.
+ * Added man pages for all functions and tools
+ * Raised buffer size for readinng/writing to 16K
+ * You can now optionally set the socket size for recv/send via memached_behavior_set/get.
0.5 Tue Oct 9 00:22:25 PDT 2007
-* Ruby maintainer mentioned TCP_NODELAY patch he had added. Added this to C
-library as well. (Eric Hodel drbrain@segment7.net)
-* Added support script for set_benchmark
-* Updated memslap to allow testing of TCP_NODELAY
-* Updated memslap to support --flush (aka dump memcache servers before testing)
-* Fixed bug in multiple hosts not being activated
-* Added environmental variable MEMCACHED_SERVERS which can be used to set the servers list.
-* fixed memcached_stat method (and now memstat works)
-* server connect now happens on demand.
-* Help for all command line applications
+ * Ruby maintainer mentioned TCP_NODELAY patch he had added. Added this to C
+ library as well. (Eric Hodel drbrain@segment7.net)
+ * Added support script for set_benchmark
+ * Updated memslap to allow testing of TCP_NODELAY
+ * Updated memslap to support --flush (aka dump memcache servers before testing)
+ * Fixed bug in multiple hosts not being activated
+ * Added environmental variable MEMCACHED_SERVERS which can be used to set the servers list.
+ * fixed memcached_stat method (and now memstat works)
+ * server connect now happens on demand.
+ * Help for all command line applications
0.4 Wed Oct 3 10:28:50 PDT 2007
-* Added buffered IO to write calls for keys
-* Added buffered IO for reads
-* memstat was broken (bad if/else on connect)
-* New non-blocking IO (not default yet). Mucho faster
-* Refactor of test system.
-* memslap crash solved
+ * Added buffered IO to write calls for keys
+ * Added buffered IO for reads
+ * memstat was broken (bad if/else on connect)
+ * New non-blocking IO (not default yet). Mucho faster
+ * Refactor of test system.
+ * memslap crash solved
0.3 Mon Oct 1 06:37:52 PDT 2007
-* Jeff Fisher <guppy@techmonkeys.org> provided a spec file
-* Added "make rpm" around dist file
-* Added support for Solaris
-* Added support for DTrace
-* Fixed read to be recv and write to be send
-* Bug fix where memstat would core if no server was found
-* Added memslap tool (load generator)
-* Numerous bug fixes in library
-* Added calls to library for creating host lists (see text cases to understand how to use this).
+ * Jeff Fisher <guppy@techmonkeys.org> provided a spec file
+ * Added "make rpm" around dist file
+ * Added support for Solaris
+ * Added support for DTrace
+ * Fixed read to be recv and write to be send
+ * Bug fix where memstat would core if no server was found
+ * Added memslap tool (load generator)
+ * Numerous bug fixes in library
+ * Added calls to library for creating host lists (see text cases to understand how to use this).
0.2 Thu Sep 27 03:46:57 PDT 2007
-* First public version
+ * First public version
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/Makefile.am
^
|
@@ -49,8 +49,12 @@
rpm: all dist generic fedora
merge-clean:
+ find ./ | $(GREP) \.gcda | xargs rm -f
+ find ./ | $(GREP) \.gcno | xargs rm -f
+ find ./ | $(GREP) \.gz | xargs rm -f
find ./ | $(GREP) \.orig | xargs rm -f
find ./ | $(GREP) \.rej | xargs rm -f
+ find ./ | $(GREP) \.rpm | xargs rm -f
find ./ | $(GREP) \~$$ | xargs rm -f
bzr unknowns
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/Makefile.in
^
|
@@ -78,7 +78,7 @@
noinst_PROGRAMS = tests/atomsmasher$(EXEEXT) tests/hashplus$(EXEEXT) \
tests/memplus$(EXEEXT) tests/startservers$(EXEEXT) \
tests/testapp$(EXEEXT) tests/testhashkit$(EXEEXT) \
- tests/testplus$(EXEEXT) example/memcached_light$(EXEEXT)
+ tests/testplus$(EXEEXT) tests/testudp$(EXEEXT) $(am__EXEEXT_2)
DIST_COMMON = README $(am__configure_deps) \
$(am__nobase_include_HEADERS_DIST) $(include_HEADERS) \
$(noinst_HEADERS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
@@ -102,21 +102,25 @@
@BUILD_BYTEORDER_TRUE@am__append_3 = libmemcached/libbyteorder.la
@BUILD_BYTEORDER_TRUE@am__append_4 = libmemcached/libbyteorder.la
@BUILD_BYTEORDER_TRUE@am__append_5 = libmemcached/libbyteorder.la
-@HAVE_DTRACE_TRUE@am__append_6 = libmemcached/dtrace_probes.h
-@HAVE_DTRACE_TRUE@am__append_7 = libmemcached/libmemcached_probes.d
-@DTRACE_NEEDS_OBJECTS_TRUE@am__append_8 = libmemcached/libmemcached_probes.o
-@HAVE_LIBEVENT_TRUE@am__append_9 = clients/memslap
-@INCLUDE_HSIEH_SRC_TRUE@am__append_10 = libhashkit/hsieh.c
-@BUILD_LIBMEMCACHEDUTIL_TRUE@am__append_11 = libmemcached/libmemcachedutil.la
-@BUILD_BYTEORDER_TRUE@am__append_12 = libmemcached/libbyteorder.la
-@HAVE_LIBINNODB_TRUE@am__append_13 = example/storage_innodb.c
-@HAVE_LIBINNODB_FALSE@am__append_14 = example/storage.c
+@HAVE_SASL_TRUE@am__append_6 = $(LIBSASL)
+@HAVE_SASL_TRUE@am__append_7 = libmemcached/sasl.c
+@HAVE_DTRACE_TRUE@am__append_8 = libmemcached/dtrace_probes.h
+@HAVE_DTRACE_TRUE@am__append_9 = libmemcached/libmemcached_probes.d
+@DTRACE_NEEDS_OBJECTS_TRUE@am__append_10 = libmemcached/libmemcached_probes.o
+@HAVE_SASL_TRUE@am__append_11 = $(LIBSASL)
+@HAVE_LIBEVENT_TRUE@am__append_12 = clients/memslap
+@INCLUDE_HSIEH_SRC_TRUE@am__append_13 = libhashkit/hsieh.c
+@BUILD_LIBMEMCACHEDUTIL_TRUE@am__append_14 = libmemcached/libmemcachedutil.la
+@HAVE_LIBEVENT_TRUE@am__append_15 = example/memcached_light
+@BUILD_BYTEORDER_TRUE@am__append_16 = libmemcached/libbyteorder.la
+@HAVE_LIBINNODB_TRUE@am__append_17 = example/storage_innodb.c
+@HAVE_LIBINNODB_FALSE@am__append_18 = example/storage.c
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_compile_stdcxx_0x.m4 \
$(top_srcdir)/m4/ac_cxx_header_stdcxx_98.m4 \
- $(top_srcdir)/m4/acx_pthread.m4 $(top_srcdir)/m4/bitfield.m4 \
- $(top_srcdir)/m4/byteorder.m4 $(top_srcdir)/m4/deprecated.m4 \
+ $(top_srcdir)/m4/acx_pthread.m4 $(top_srcdir)/m4/byteorder.m4 \
+ $(top_srcdir)/m4/deprecated.m4 \
$(top_srcdir)/m4/enable_utillib.m4 $(top_srcdir)/m4/hsieh.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
@@ -141,6 +145,7 @@
$(top_srcdir)/m4/pandora_platform.m4 \
$(top_srcdir)/m4/pandora_print_callstack.m4 \
$(top_srcdir)/m4/pandora_pthread.m4 \
+ $(top_srcdir)/m4/pandora_sasl.m4 \
$(top_srcdir)/m4/pandora_shared_ptr.m4 \
$(top_srcdir)/m4/pandora_stack_direction.m4 \
$(top_srcdir)/m4/pandora_use_pipe.m4 \
@@ -277,8 +282,10 @@
libmemcached/server.c libmemcached/server_list.c \
libmemcached/stats.c libmemcached/storage.c \
libmemcached/strerror.c libmemcached/verbosity.c \
- libmemcached/version.c libmemcached/libmemcached_probes.d
-am__objects_4 =
+ libmemcached/version.c libmemcached/sasl.c \
+ libmemcached/libmemcached_probes.d
+@HAVE_SASL_TRUE@am__objects_4 = libmemcached/libmemcached_libmemcached_la-sasl.lo
+am__objects_5 =
am_libmemcached_libmemcached_la_OBJECTS = \
libmemcached/libmemcached_libmemcached_la-allocators.lo \
libmemcached/libmemcached_libmemcached_la-analyze.lo \
@@ -309,7 +316,7 @@
libmemcached/libmemcached_libmemcached_la-strerror.lo \
libmemcached/libmemcached_libmemcached_la-verbosity.lo \
libmemcached/libmemcached_libmemcached_la-version.lo \
- $(am__objects_4)
+ $(am__objects_4) $(am__objects_5)
libmemcached_libmemcached_la_OBJECTS = \
$(am_libmemcached_libmemcached_la_OBJECTS)
libmemcached_libmemcached_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
@@ -359,6 +366,7 @@
am_tests_libtest_la_OBJECTS = tests/test.lo
tests_libtest_la_OBJECTS = $(am_tests_libtest_la_OBJECTS)
@HAVE_LIBEVENT_TRUE@am__EXEEXT_1 = clients/memslap$(EXEEXT)
+@HAVE_LIBEVENT_TRUE@am__EXEEXT_2 = example/memcached_light$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
am_clients_memcapable_OBJECTS = clients/memcapable.$(OBJEXT)
clients_memcapable_OBJECTS = $(am_clients_memcapable_OBJECTS)
@@ -366,50 +374,51 @@
@BUILD_BYTEORDER_TRUE@ libmemcached/libbyteorder.la
am_clients_memcat_OBJECTS = clients/memcat.$(OBJEXT)
clients_memcat_OBJECTS = $(am_clients_memcat_OBJECTS)
-am__DEPENDENCIES_1 = clients/libutilities.la \
- libmemcached/libmemcached.la
-clients_memcat_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am__DEPENDENCIES_1 =
+@HAVE_SASL_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
+am__DEPENDENCIES_3 = clients/libutilities.la \
+ libmemcached/libmemcached.la $(am__DEPENDENCIES_2)
+clients_memcat_DEPENDENCIES = $(am__DEPENDENCIES_3)
am_clients_memcp_OBJECTS = clients/memcp.$(OBJEXT)
clients_memcp_OBJECTS = $(am_clients_memcp_OBJECTS)
-clients_memcp_DEPENDENCIES = $(am__DEPENDENCIES_1)
+clients_memcp_DEPENDENCIES = $(am__DEPENDENCIES_3)
am_clients_memdump_OBJECTS = clients/memdump.$(OBJEXT)
clients_memdump_OBJECTS = $(am_clients_memdump_OBJECTS)
-clients_memdump_DEPENDENCIES = $(am__DEPENDENCIES_1)
+clients_memdump_DEPENDENCIES = $(am__DEPENDENCIES_3)
am_clients_memerror_OBJECTS = clients/memerror.$(OBJEXT)
clients_memerror_OBJECTS = $(am_clients_memerror_OBJECTS)
-clients_memerror_DEPENDENCIES = $(am__DEPENDENCIES_1)
+clients_memerror_DEPENDENCIES = $(am__DEPENDENCIES_3)
am_clients_memflush_OBJECTS = clients/memflush.$(OBJEXT)
clients_memflush_OBJECTS = $(am_clients_memflush_OBJECTS)
-clients_memflush_DEPENDENCIES = $(am__DEPENDENCIES_1)
+clients_memflush_DEPENDENCIES = $(am__DEPENDENCIES_3)
am_clients_memrm_OBJECTS = clients/memrm.$(OBJEXT)
clients_memrm_OBJECTS = $(am_clients_memrm_OBJECTS)
-clients_memrm_DEPENDENCIES = $(am__DEPENDENCIES_1)
+clients_memrm_DEPENDENCIES = $(am__DEPENDENCIES_3)
am_clients_memslap_OBJECTS = clients/memslap.$(OBJEXT) \
clients/ms_conn.$(OBJEXT) clients/ms_setting.$(OBJEXT) \
clients/ms_sigsegv.$(OBJEXT) clients/ms_stats.$(OBJEXT) \
clients/ms_task.$(OBJEXT) clients/ms_thread.$(OBJEXT)
clients_memslap_OBJECTS = $(am_clients_memslap_OBJECTS)
-am__DEPENDENCIES_2 =
-clients_memslap_DEPENDENCIES = $(am__DEPENDENCIES_2) \
- clients/libgenexec.la $(am__DEPENDENCIES_1)
+clients_memslap_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ clients/libgenexec.la $(am__DEPENDENCIES_3)
am_clients_memstat_OBJECTS = clients/memstat.$(OBJEXT)
clients_memstat_OBJECTS = $(am_clients_memstat_OBJECTS)
-clients_memstat_DEPENDENCIES = $(am__DEPENDENCIES_1)
+clients_memstat_DEPENDENCIES = $(am__DEPENDENCIES_3)
am__example_memcached_light_SOURCES_DIST = example/interface_v0.c \
example/interface_v1.c example/memcached_light.c \
example/memcached_light.h example/storage.h \
example/storage_innodb.c example/storage.c
-@HAVE_LIBINNODB_TRUE@am__objects_5 = example/storage_innodb.$(OBJEXT)
-@HAVE_LIBINNODB_FALSE@am__objects_6 = example/storage.$(OBJEXT)
+@HAVE_LIBINNODB_TRUE@am__objects_6 = example/storage_innodb.$(OBJEXT)
+@HAVE_LIBINNODB_FALSE@am__objects_7 = example/storage.$(OBJEXT)
am_example_memcached_light_OBJECTS = example/interface_v0.$(OBJEXT) \
example/interface_v1.$(OBJEXT) \
- example/memcached_light.$(OBJEXT) $(am__objects_5) \
- $(am__objects_6)
+ example/memcached_light.$(OBJEXT) $(am__objects_6) \
+ $(am__objects_7)
example_memcached_light_OBJECTS = \
$(am_example_memcached_light_OBJECTS)
example_memcached_light_DEPENDENCIES = \
- libmemcached/libmemcachedprotocol.la $(am__DEPENDENCIES_2) \
- $(am__append_12)
+ libmemcached/libmemcachedprotocol.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__append_16)
am_tests_atomsmasher_OBJECTS = tests/atomsmasher.$(OBJEXT)
tests_atomsmasher_OBJECTS = $(am_tests_atomsmasher_OBJECTS)
am_tests_hashplus_OBJECTS = tests/hash_plus.$(OBJEXT)
@@ -428,6 +437,11 @@
tests_testhashkit_OBJECTS = $(am_tests_testhashkit_OBJECTS)
am_tests_testplus_OBJECTS = tests/plus.$(OBJEXT)
tests_testplus_OBJECTS = $(am_tests_testplus_OBJECTS)
+am_tests_testudp_OBJECTS = tests/tests_testudp-mem_udp.$(OBJEXT)
+tests_testudp_OBJECTS = $(am_tests_testudp_OBJECTS)
+tests_testudp_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(tests_testudp_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES =
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
am__depfiles_maybe = depfiles
@@ -489,7 +503,7 @@
$(tests_atomsmasher_SOURCES) $(tests_hashplus_SOURCES) \
$(tests_memplus_SOURCES) $(tests_startservers_SOURCES) \
$(tests_testapp_SOURCES) $(tests_testhashkit_SOURCES) \
- $(tests_testplus_SOURCES)
+ $(tests_testplus_SOURCES) $(tests_testudp_SOURCES)
DIST_SOURCES = $(clients_libgenexec_la_SOURCES) \
$(clients_libutilities_la_SOURCES) \
$(am__libhashkit_libhashkit_la_SOURCES_DIST) \
@@ -510,7 +524,7 @@
$(tests_atomsmasher_SOURCES) $(tests_hashplus_SOURCES) \
$(tests_memplus_SOURCES) $(tests_startservers_SOURCES) \
$(tests_testapp_SOURCES) $(tests_testhashkit_SOURCES) \
- $(tests_testplus_SOURCES)
+ $(tests_testplus_SOURCES) $(tests_testudp_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
@@ -531,7 +545,8 @@
libmemcached/memcached/protocol_binary.h libmemcached/parse.h \
libmemcached/protocol/cache.h libmemcached/protocol/callback.h \
libmemcached/protocol_handler.h libmemcached/quit.h \
- libmemcached/result.h libmemcached/server.h \
+ libmemcached/result.h libmemcached/sasl.h \
+ libmemcached/server.h libmemcached/server_list.h \
libmemcached/stats.h libmemcached/storage.h \
libmemcached/strerror.h libmemcached/string.h \
libmemcached/types.h libmemcached/verbosity.h \
@@ -634,10 +649,11 @@
FGREP = @FGREP@
GCOV_LIBS = @GCOV_LIBS@
GREP = @GREP@
-HASHKIT_BITFIELD = @HASHKIT_BITFIELD@
HASHKIT_LIBRARY_VERSION = @HASHKIT_LIBRARY_VERSION@
HAVE_LIBEVENT = @HAVE_LIBEVENT@
HAVE_LIBINNODB = @HAVE_LIBINNODB@
+HAVE_LIBSASL = @HAVE_LIBSASL@
+HAVE_LIBSASL2 = @HAVE_LIBSASL2@
HAVE_VISIBILITY = @HAVE_VISIBILITY@
INNOBASE_SKIP_WARNINGS = @INNOBASE_SKIP_WARNINGS@
INSTALL = @INSTALL@
@@ -653,16 +669,22 @@
LIBEVENT_PREFIX = @LIBEVENT_PREFIX@
LIBINNODB = @LIBINNODB@
LIBINNODB_PREFIX = @LIBINNODB_PREFIX@
+LIBMEMCACHED_WITH_SASL_SUPPORT = @LIBMEMCACHED_WITH_SASL_SUPPORT@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSASL = @LIBSASL@
+LIBSASL2 = @LIBSASL2@
+LIBSASL2_PREFIX = @LIBSASL2_PREFIX@
+LIBSASL_PREFIX = @LIBSASL_PREFIX@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBEVENT = @LTLIBEVENT@
LTLIBINNODB = @LTLIBINNODB@
LTLIBOBJS = @LTLIBOBJS@
+LTLIBSASL = @LTLIBSASL@
+LTLIBSASL2 = @LTLIBSASL2@
MAKEINFO = @MAKEINFO@
-MEMCACHED_BITFIELD = @MEMCACHED_BITFIELD@
MEMCACHED_LIBRARY_VERSION = @MEMCACHED_LIBRARY_VERSION@
MEMC_BINARY = @MEMC_BINARY@
MKDIR_P = @MKDIR_P@
@@ -805,7 +827,8 @@
libmemcached/memcached/protocol_binary.h libmemcached/parse.h \
libmemcached/protocol/cache.h libmemcached/protocol/callback.h \
libmemcached/protocol_handler.h libmemcached/quit.h \
- libmemcached/result.h libmemcached/server.h \
+ libmemcached/result.h libmemcached/sasl.h \
+ libmemcached/server.h libmemcached/server_list.h \
libmemcached/stats.h libmemcached/storage.h \
libmemcached/strerror.h libmemcached/string.h \
libmemcached/types.h libmemcached/verbosity.h \
@@ -817,7 +840,7 @@
libhashkit/strerror.h libhashkit/types.h \
libhashkit/visibility.h
EXTRA_HEADERS =
-BUILT_SOURCES = $(am__append_6)
+BUILT_SOURCES = $(am__append_8)
EXTRA_DIST = README.FIRST libmemcached/configure.h.in \
libmemcached/libmemcached_probes.d \
libmemcached/memcached/README.txt libhashkit/configure.h.in \
@@ -834,7 +857,7 @@
libmemcached/protocol/pedantic.c \
libmemcached/protocol/protocol_handler.c
-libmemcached_libmemcachedprotocol_la_LDFLAGS = ${AM_LDFLAGS} -version-info 0:0:0
+libmemcached_libmemcachedprotocol_la_LDFLAGS = ${AM_LDFLAGS} -version-info 0:0:0
libmemcached_libmemcachedcallbacks_la_CFLAGS = ${AM_CFLAGS} ${NO_STRICT_ALIASING}
libmemcached_libmemcachedcallbacks_la_SOURCES = libmemcached/callback.c
libmemcached_libmemcachedinternal_la_SOURCES = \
@@ -854,16 +877,17 @@
libmemcached/server.c libmemcached/server_list.c \
libmemcached/stats.c libmemcached/storage.c \
libmemcached/strerror.c libmemcached/verbosity.c \
- libmemcached/version.c $(am__append_7)
+ libmemcached/version.c $(am__append_7) $(am__append_9)
libmemcached_libmemcached_la_DEPENDENCIES = \
libmemcached/libmemcachedcallbacks.la \
libmemcached/libmemcachedinternal.la \
- libhashkit/libhashkitinc.la $(am__append_5) $(am__append_8)
+ libhashkit/libhashkitinc.la $(am__append_5) $(am__append_10)
libmemcached_libmemcached_la_LIBADD = $(LIBM) \
libmemcached/libmemcachedcallbacks.la \
libmemcached/libmemcachedinternal.la \
libhashkit/libhashkitinc.la $(am__append_4)
-libmemcached_libmemcached_la_LDFLAGS = ${AM_LDFLAGS} -version-info ${MEMCACHED_LIBRARY_VERSION}
+libmemcached_libmemcached_la_LDFLAGS = ${AM_LDFLAGS} -version-info \
+ ${MEMCACHED_LIBRARY_VERSION} $(am__append_6)
libmemcached_libmemcachedutil_la_SOURCES = libmemcached/util/pool.c
libmemcached_libmemcachedutil_la_LIBADD = libmemcached/libmemcached.la
libmemcached_libmemcachedutil_la_LDFLAGS = ${AM_LDFLAGS} -version-info 0:0:0
@@ -871,11 +895,8 @@
@BUILD_BYTEORDER_TRUE@libmemcached_libbyteorder_la_SOURCES = libmemcached/byteorder.c
@BUILD_BYTEORDER_TRUE@libmemcached_libmemcachedprotocol_la_LIBADD = libmemcached/libbyteorder.la
@BUILD_BYTEORDER_TRUE@libmemcached_libmemcachedprotocol_la_DEPENDENCIES = libmemcached/libbyteorder.la
-CLIENTS_LDADDS = \
- $(LIBM) \
- clients/libutilities.la \
- libmemcached/libmemcached.la
-
+CLIENTS_LDADDS = $(LIBM) clients/libutilities.la \
+ libmemcached/libmemcached.la $(am__append_11)
clients_libutilities_la_SOURCES = clients/utilities.c
clients_libgenexec_la_SOURCES = clients/generator.c clients/execute.c
clients_memcat_SOURCES = clients/memcat.c
@@ -909,7 +930,7 @@
libhashkit/digest.c libhashkit/function.c libhashkit/hashkit.c \
libhashkit/jenkins.c libhashkit/ketama.c libhashkit/md5.c \
libhashkit/murmur.c libhashkit/one_at_a_time.c \
- libhashkit/strerror.c $(am__append_10)
+ libhashkit/strerror.c $(am__append_13)
libhashkit_libhashkit_la_CFLAGS = \
${AM_CFLAGS} \
-DBUILDING_HASHKIT
@@ -921,7 +942,7 @@
libhashkit_libhashkitinc_la_SOURCES = ${libhashkit_libhashkit_la_SOURCES}
libhashkit_libhashkitinc_la_CFLAGS = ${libhashkit_libhashkit_la_CFLAGS}
libhashkit_libhashkitinc_la_LDFLAGS = $(LIBM)
-TESTS_LDADDS = libmemcached/libmemcached.la $(am__append_11)
+TESTS_LDADDS = libmemcached/libmemcached.la $(am__append_14)
VALGRIND_COMMAND = $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes
DEBUG_COMMAND = $(LIBTOOL) --mode=execute gdb
PAHOLE_COMMAND = $(LIBTOOL) --mode=execute pahole
@@ -929,50 +950,60 @@
tests_libtest_la_SOURCES = tests/test.c
tests_testapp_CFLAGS = $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
tests_testapp_SOURCES = tests/mem_functions.c
-tests_testapp_LDADD = \
+tests_testapp_DEPENDENCIES = \
clients/libgenexec.la \
tests/libserver.la \
tests/libtest.la \
libmemcached/libmemcachedinternal.la \
-$(TESTS_LDADDS)
+ $(TESTS_LDADDS)
-tests_testapp_DEPENDENCIES = $(tests_testapp_LDADD)
+tests_testapp_LDADD = $(tests_testapp_DEPENDENCIES) $(LIBSASL)
tests_testplus_SOURCES = tests/plus.cpp
-tests_testplus_LDADD = tests/libtest.la tests/libserver.la $(TESTS_LDADDS)
-tests_testplus_DEPENDENCIES = $(tests_testplus_LDADD)
+tests_testplus_DEPENDENCIES = tests/libtest.la tests/libserver.la $(TESTS_LDADDS)
+tests_testplus_LDADD = $(tests_testplus_DEPENDENCIES) $(LIBSASL)
tests_atomsmasher_SOURCES = tests/atomsmasher.c
-tests_atomsmasher_LDADD = \
+tests_atomsmasher_DEPENDENCIES = \
clients/libgenexec.la \
tests/libserver.la \
tests/libtest.la \
$(TESTS_LDADDS)
-tests_atomsmasher_DEPENDENCIES = $(tests_atomsmasher_LDADD)
+tests_atomsmasher_LDADD = $(tests_atomsmasher_DEPENDENCIES) $(LIBSASL)
+tests_testudp_CFLAGS = $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
+tests_testudp_SOURCES = tests/mem_udp.c
+tests_testudp_DEPENDENCIES = \
+ clients/libgenexec.la \
+ tests/libserver.la \
+ tests/libtest.la \
+ $(TESTS_LDADDS)
+
+tests_testudp_LDADD = $(tests_testudp_DEPENDENCIES) $(LIBSASL)
tests_startservers_SOURCES = tests/start.c
-tests_startservers_LDADD = tests/libserver.la $(TESTS_LDADDS)
-tests_startservers_DEPENDENCIES = $(tests_startservers_LDADD)
+tests_startservers_DEPENDENCIES = tests/libserver.la $(TESTS_LDADDS)
+tests_startservers_LDADD = $(tests_startservers_DEPENDENCIES) $(LIBSASL)
tests_testhashkit_SOURCES = tests/hashkit_functions.c
-tests_testhashkit_LDADD = tests/libtest.la libhashkit/libhashkit.la
-tests_testhashkit_DEPENDENCIES = $(tests_testhashkit_LDADD)
+tests_testhashkit_DEPENDENCIES = tests/libtest.la libhashkit/libhashkit.la
+tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES) $(LIBSASL)
tests_hashplus_SOURCES = tests/hash_plus.cc
-tests_hashplus_LDADD = $(tests_testhashkit_LDADD)
-tests_hashplus_DEPENDENCIES = $(tests_testhashkit_LDADD)
+tests_hashplus_DEPENDENCIES = $(tests_testhashkit_DEPENDENCIES)
+tests_hashplus_LDADD = $(tests_testhashkit_DEPENDENCIES) $(LIBSASL)
tests_memplus_SOURCES = tests/mem_plus.cc
-tests_memplus_LDADD = tests/libtest.la tests/libserver.la libmemcached/libmemcached.la
-tests_memplus_DEPENDENCIES = $(tests_memplus_LDADD)
+tests_memplus_DEPENDENCIES = tests/libtest.la tests/libserver.la libmemcached/libmemcached.la
+tests_memplus_LDADD = $(tests_memplus_DEPENDENCIES)
MEMSLAP_COMMAND = clients/memslap $(COLLECTION) $(SUITE)
MEM_COMMAND = tests/testapp $(COLLECTION) $(SUITE)
TESTPLUS_COMMAND = tests/testplus $(COLLECTION) $(SUITE)
MEMPLUS_COMMAND = tests/memplus $(COLLECTION) $(SUITE)
HASHPLUS_COMMAND = tests/hashplus $(COLLECTION) $(SUITE)
ATOM_COMMAND = tests/atomsmasher $(COLLECTION) $(SUITE)
+UDP_COMMAND = tests/testudp $(COLLECTION) $(SUITE)
HASH_COMMAND = tests/testhashkit $(COLLECTION) $(SUITE)
example_memcached_light_SOURCES = example/interface_v0.c \
example/interface_v1.c example/memcached_light.c \
- example/memcached_light.h example/storage.h $(am__append_13) \
- $(am__append_14)
+ example/memcached_light.h example/storage.h $(am__append_17) \
+ $(am__append_18)
example_memcached_light_LDADD = libmemcached/libmemcachedprotocol.la \
- $(LIBINNODB) $(am__append_12)
+ $(LIBINNODB) $(LTLIBEVENT) $(am__append_16)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = support/libmemcached.pc
all: $(BUILT_SOURCES) config.h
@@ -1288,6 +1319,9 @@
libmemcached/libmemcached_libmemcached_la-version.lo: \
libmemcached/$(am__dirstamp) \
libmemcached/$(DEPDIR)/$(am__dirstamp)
+libmemcached/libmemcached_libmemcached_la-sasl.lo: \
+ libmemcached/$(am__dirstamp) \
+ libmemcached/$(DEPDIR)/$(am__dirstamp)
libmemcached/libmemcached.la: $(libmemcached_libmemcached_la_OBJECTS) $(libmemcached_libmemcached_la_DEPENDENCIES) libmemcached/$(am__dirstamp)
$(AM_V_CCLD)$(libmemcached_libmemcached_la_LINK) -rpath $(libdir) $(libmemcached_libmemcached_la_OBJECTS) $(libmemcached_libmemcached_la_LIBADD) $(LIBS)
libmemcached/libmemcached_libmemcachedcallbacks_la-callback.lo: \
@@ -1506,6 +1540,11 @@
tests/testplus$(EXEEXT): $(tests_testplus_OBJECTS) $(tests_testplus_DEPENDENCIES) tests/$(am__dirstamp)
@rm -f tests/testplus$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(tests_testplus_OBJECTS) $(tests_testplus_LDADD) $(LIBS)
+tests/tests_testudp-mem_udp.$(OBJEXT): tests/$(am__dirstamp) \
+ tests/$(DEPDIR)/$(am__dirstamp)
+tests/testudp$(EXEEXT): $(tests_testudp_OBJECTS) $(tests_testudp_DEPENDENCIES) tests/$(am__dirstamp)
+ @rm -f tests/testudp$(EXEEXT)
+ $(AM_V_CCLD)$(tests_testudp_LINK) $(tests_testudp_OBJECTS) $(tests_testudp_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -1637,6 +1676,8 @@
-rm -f libmemcached/libmemcached_libmemcached_la-response.lo
-rm -f libmemcached/libmemcached_libmemcached_la-result.$(OBJEXT)
-rm -f libmemcached/libmemcached_libmemcached_la-result.lo
+ -rm -f libmemcached/libmemcached_libmemcached_la-sasl.$(OBJEXT)
+ -rm -f libmemcached/libmemcached_libmemcached_la-sasl.lo
-rm -f libmemcached/libmemcached_libmemcached_la-server.$(OBJEXT)
-rm -f libmemcached/libmemcached_libmemcached_la-server.lo
-rm -f libmemcached/libmemcached_libmemcached_la-server_list.$(OBJEXT)
@@ -1678,6 +1719,7 @@
-rm -f tests/test.$(OBJEXT)
-rm -f tests/test.lo
-rm -f tests/tests_testapp-mem_functions.$(OBJEXT)
+ -rm -f tests/tests_testudp-mem_udp.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@@ -1756,6 +1798,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@libmemcached/$(DEPDIR)/libmemcached_libmemcached_la-quit.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libmemcached/$(DEPDIR)/libmemcached_libmemcached_la-response.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libmemcached/$(DEPDIR)/libmemcached_libmemcached_la-result.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libmemcached/$(DEPDIR)/libmemcached_libmemcached_la-sasl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libmemcached/$(DEPDIR)/libmemcached_libmemcached_la-server.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libmemcached/$(DEPDIR)/libmemcached_libmemcached_la-server_list.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@libmemcached/$(DEPDIR)/libmemcached_libmemcached_la-stats.Plo@am__quote@
@@ -1780,6 +1823,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/start.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/test.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_testapp-mem_functions.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_testudp-mem_udp.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -2264,6 +2308,14 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmemcached_libmemcached_la_CFLAGS) $(CFLAGS) -c -o libmemcached/libmemcached_libmemcached_la-version.lo `test -f 'libmemcached/version.c' || echo '$(srcdir)/'`libmemcached/version.c
+libmemcached/libmemcached_libmemcached_la-sasl.lo: libmemcached/sasl.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmemcached_libmemcached_la_CFLAGS) $(CFLAGS) -MT libmemcached/libmemcached_libmemcached_la-sasl.lo -MD -MP -MF libmemcached/$(DEPDIR)/libmemcached_libmemcached_la-sasl.Tpo -c -o libmemcached/libmemcached_libmemcached_la-sasl.lo `test -f 'libmemcached/sasl.c' || echo '$(srcdir)/'`libmemcached/sasl.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libmemcached/$(DEPDIR)/libmemcached_libmemcached_la-sasl.Tpo libmemcached/$(DEPDIR)/libmemcached_libmemcached_la-sasl.Plo
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libmemcached/sasl.c' object='libmemcached/libmemcached_libmemcached_la-sasl.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmemcached_libmemcached_la_CFLAGS) $(CFLAGS) -c -o libmemcached/libmemcached_libmemcached_la-sasl.lo `test -f 'libmemcached/sasl.c' || echo '$(srcdir)/'`libmemcached/sasl.c
+
libmemcached/libmemcached_libmemcachedcallbacks_la-callback.lo: libmemcached/callback.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmemcached_libmemcachedcallbacks_la_CFLAGS) $(CFLAGS) -MT libmemcached/libmemcached_libmemcachedcallbacks_la-callback.lo -MD -MP -MF libmemcached/$(DEPDIR)/libmemcached_libmemcachedcallbacks_la-callback.Tpo -c -o libmemcached/libmemcached_libmemcachedcallbacks_la-callback.lo `test -f 'libmemcached/callback.c' || echo '$(srcdir)/'`libmemcached/callback.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libmemcached/$(DEPDIR)/libmemcached_libmemcachedcallbacks_la-callback.Tpo libmemcached/$(DEPDIR)/libmemcached_libmemcachedcallbacks_la-callback.Plo
@@ -2288,6 +2340,22 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_testapp_CFLAGS) $(CFLAGS) -c -o tests/tests_testapp-mem_functions.obj `if test -f 'tests/mem_functions.c'; then $(CYGPATH_W) 'tests/mem_functions.c'; else $(CYGPATH_W) '$(srcdir)/tests/mem_functions.c'; fi`
+tests/tests_testudp-mem_udp.o: tests/mem_udp.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_testudp_CFLAGS) $(CFLAGS) -MT tests/tests_testudp-mem_udp.o -MD -MP -MF tests/$(DEPDIR)/tests_testudp-mem_udp.Tpo -c -o tests/tests_testudp-mem_udp.o `test -f 'tests/mem_udp.c' || echo '$(srcdir)/'`tests/mem_udp.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_testudp-mem_udp.Tpo tests/$(DEPDIR)/tests_testudp-mem_udp.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tests/mem_udp.c' object='tests/tests_testudp-mem_udp.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_testudp_CFLAGS) $(CFLAGS) -c -o tests/tests_testudp-mem_udp.o `test -f 'tests/mem_udp.c' || echo '$(srcdir)/'`tests/mem_udp.c
+
+tests/tests_testudp-mem_udp.obj: tests/mem_udp.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_testudp_CFLAGS) $(CFLAGS) -MT tests/tests_testudp-mem_udp.obj -MD -MP -MF tests/$(DEPDIR)/tests_testudp-mem_udp.Tpo -c -o tests/tests_testudp-mem_udp.obj `if test -f 'tests/mem_udp.c'; then $(CYGPATH_W) 'tests/mem_udp.c'; else $(CYGPATH_W) '$(srcdir)/tests/mem_udp.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_testudp-mem_udp.Tpo tests/$(DEPDIR)/tests_testudp-mem_udp.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tests/mem_udp.c' object='tests/tests_testudp-mem_udp.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_testudp_CFLAGS) $(CFLAGS) -c -o tests/tests_testudp-mem_udp.obj `if test -f 'tests/mem_udp.c'; then $(CYGPATH_W) 'tests/mem_udp.c'; else $(CYGPATH_W) '$(srcdir)/tests/mem_udp.c'; fi`
+
.cc.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@@ -3082,21 +3150,21 @@
test-memflush: clients/memflush
@echo "Testing memflush"
- @/usr/local/bin/memcached -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memflush --servers="localhost:12555"
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@rm tests/Xumemc.pid
valgrind-memflush: clients/memflush
@echo "Testing memflush"
- @/usr/local/bin/memcached -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
@$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@rm tests/Xumemc.pid
test-memdump: clients/memdump clients/memcp
@echo "Testing memdump"
- @/usr/local/bin/memcached -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memcp --servers="localhost:12555" clients/memcat
@clients/memdump --servers="localhost:12555" > /dev/null
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@@ -3104,7 +3172,7 @@
valgrind-memdump: clients/memcat clients/memcp
@echo "Testing memdump"
- @/usr/local/bin/memcached -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memcp --servers="localhost:12555" clients/memcat
@$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@@ -3112,14 +3180,14 @@
test-memstat: clients/memstat
@echo "Testing memstat"
- @/usr/local/bin/memcached -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memstat --servers="localhost:12555" > /dev/null
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@rm tests/Xumemc.pid
valgrind-memstat: clients/memstat
@echo "Testing memstat"
- @/usr/local/bin/memcached -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
@$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@rm tests/Xumemc.pid
@@ -3135,6 +3203,9 @@
test-mem: tests/testapp
$(MEM_COMMAND)
+test-udp: tests/testudp
+ $(UDP_COMMAND)
+
test-atom: tests/atomsmasher
$(ATOM_COMMAND)
@@ -3157,6 +3228,9 @@
$(DEBUG_COMMAND) $(MEM_COMMAND)
gdb-atom: tests/atomsmasher
+ $(DEBUG_COMMAND) $(UDP_COMMAND)
+
+gdb-udp: tests/testudp
$(DEBUG_COMMAND) $(ATOM_COMMAND)
gdb-plus: tests/testplus
@@ -3180,6 +3254,9 @@
valgrind-atom: tests/atomsmasher
$(VALGRIND_COMMAND) $(ATOM_COMMAND)
+valgrind-udp: tests/testudp
+ $(VALGRIND_COMMAND) $(UDP_COMMAND)
+
valgrind-plus: tests/testplus
$(VALGRIND_COMMAND) $(TESTPLUS_COMMAND)
@@ -3235,8 +3312,12 @@
rpm: all dist generic fedora
merge-clean:
+ find ./ | $(GREP) \.gcda | xargs rm -f
+ find ./ | $(GREP) \.gcno | xargs rm -f
+ find ./ | $(GREP) \.gz | xargs rm -f
find ./ | $(GREP) \.orig | xargs rm -f
find ./ | $(GREP) \.rej | xargs rm -f
+ find ./ | $(GREP) \.rpm | xargs rm -f
find ./ | $(GREP) \~$$ | xargs rm -f
bzr unknowns
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/README.FIRST
^
|
@@ -11,7 +11,7 @@
Once the tree is cloned you will need to build the "configure" script. You
can do this by running the script:
-./config/autogen.sh
+./config/autorun.sh
It will set up all of the files you need to build libmemcached. At that
point it is just the typical "./configure; make; make test; make install"
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/aclocal.m4
^
|
@@ -1026,7 +1026,6 @@
m4_include([m4/ac_cxx_compile_stdcxx_0x.m4])
m4_include([m4/ac_cxx_header_stdcxx_98.m4])
m4_include([m4/acx_pthread.m4])
-m4_include([m4/bitfield.m4])
m4_include([m4/byteorder.m4])
m4_include([m4/deprecated.m4])
m4_include([m4/enable_utillib.m4])
@@ -1058,6 +1057,7 @@
m4_include([m4/pandora_platform.m4])
m4_include([m4/pandora_print_callstack.m4])
m4_include([m4/pandora_pthread.m4])
+m4_include([m4/pandora_sasl.m4])
m4_include([m4/pandora_shared_ptr.m4])
m4_include([m4/pandora_stack_direction.m4])
m4_include([m4/pandora_use_pipe.m4])
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/clients/client_options.h
^
|
@@ -35,7 +35,9 @@
OPT_FLUSH,
OPT_HASH,
OPT_BINARY,
- OPT_UDP
+ OPT_UDP,
+ OPT_USERNAME,
+ OPT_PASSWD
} memcached_options;
#endif /* CLIENT_OPTIONS */
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/clients/generator.c
^
|
@@ -42,14 +42,15 @@
{
uint32_t x;
- if (!pairs)
+ if (! pairs)
return;
/* We free until we hit the null pair we stores during creation */
for (x= 0; pairs[x].key; x++)
{
free(pairs[x].key);
- free(pairs[x].value);
+ if (pairs[x].value)
+ free(pairs[x].value);
}
free(pairs);
@@ -73,11 +74,19 @@
get_random_string(pairs[x].key, 100);
pairs[x].key_length= 100;
- pairs[x].value= (char *)calloc(value_length, sizeof(char));
- if (!pairs[x].value)
- goto error;
- get_random_string(pairs[x].value, value_length);
- pairs[x].value_length= value_length;
+ if (value_length)
+ {
+ pairs[x].value= (char *)calloc(value_length, sizeof(char));
+ if (!pairs[x].value)
+ goto error;
+ get_random_string(pairs[x].value, value_length);
+ pairs[x].value_length= value_length;
+ }
+ else
+ {
+ pairs[x].value= NULL;
+ pairs[x].value_length= 0;
+ }
}
return pairs;
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/clients/include.am
^
|
@@ -7,6 +7,10 @@
clients/libutilities.la \
libmemcached/libmemcached.la
+if HAVE_SASL
+CLIENTS_LDADDS+= $(LIBSASL)
+endif
+
bin_PROGRAMS+= \
clients/memcapable \
clients/memcat \
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/clients/memcapable.c
^
|
@@ -575,18 +575,31 @@
#define validate_response_header(a,b,c) \
do_validate_response_header(a,b,c) == TEST_PASS
-static enum test_return test_binary_noop(void)
+
+static enum test_return send_binary_noop(void)
{
command cmd;
- response rsp;
raw_command(&cmd, PROTOCOL_BINARY_CMD_NOOP, NULL, 0, NULL, 0);
execute(send_packet(&cmd));
+ return TEST_PASS;
+}
+
+static enum test_return receive_binary_noop(void)
+{
+ response rsp;
execute(recv_packet(&rsp));
verify(validate_response_header(&rsp, PROTOCOL_BINARY_CMD_NOOP,
PROTOCOL_BINARY_RESPONSE_SUCCESS));
return TEST_PASS;
}
+static enum test_return test_binary_noop(void)
+{
+ execute(send_binary_noop());
+ execute(receive_binary_noop());
+ return TEST_PASS;
+}
+
static enum test_return test_binary_quit_impl(uint8_t cc)
{
command cmd;
@@ -854,19 +867,23 @@
raw_command(&cmd, cc, key, strlen(key), NULL, 0);
execute(send_packet(&cmd));
+ execute(send_binary_noop());
if (cc == PROTOCOL_BINARY_CMD_GET || cc == PROTOCOL_BINARY_CMD_GETK)
{
execute(recv_packet(&rsp));
verify(validate_response_header(&rsp, cc, PROTOCOL_BINARY_RESPONSE_KEY_ENOENT));
}
- else
- execute(test_binary_noop());
+
+ execute(receive_binary_noop());
execute(binary_set_item(key, key));
execute(resend_packet(&cmd));
+ execute(send_binary_noop());
+
execute(recv_packet(&rsp));
verify(validate_response_header(&rsp, cc, PROTOCOL_BINARY_RESPONSE_SUCCESS));
+ execute(receive_binary_noop());
return TEST_PASS;
}
@@ -1114,24 +1131,6 @@
return TEST_PASS;
}
-static enum test_return test_binary_illegal(void)
-{
- command cmd;
- response rsp;
- uint8_t cc= 0x1b;
-
- while (cc != 0x00)
- {
- raw_command(&cmd, cc, NULL, 0, NULL, 0);
- execute(send_packet(&cmd));
- execute(recv_packet(&rsp));
- verify(validate_response_header(&rsp, cc, PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND));
- ++cc;
- }
-
- return TEST_PASS_RECONNECT;
-}
-
static enum test_return send_string(const char *cmd)
{
execute(retry_write(cmd, strlen(cmd)));
@@ -1851,7 +1850,6 @@
{ "binary prepend", test_binary_prepend },
{ "binary prependq", test_binary_prependq },
{ "binary stat", test_binary_stat },
- { "binary illegal", test_binary_illegal },
{ NULL, NULL}
};
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/clients/memcat.c
^
|
@@ -31,6 +31,8 @@
static int opt_displayflag= 0;
static char *opt_servers= NULL;
static char *opt_hash= NULL;
+static char *opt_username;
+static char *opt_passwd;
int main(int argc, char *argv[])
{
@@ -68,11 +70,17 @@
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL,
(uint64_t)opt_binary);
- while (optind < argc)
+ if (!initialize_sasl(memc, opt_username, opt_passwd))
+ {
+ memcached_free(memc);
+ return 1;
+ }
+
+ while (optind < argc)
{
string= memcached_get(memc, argv[optind], strlen(argv[optind]),
&string_length, &flags, &rc);
- if (rc == MEMCACHED_SUCCESS)
+ if (rc == MEMCACHED_SUCCESS)
{
if (opt_displayflag)
{
@@ -80,7 +88,7 @@
printf("key: %s\nflags: ", argv[optind]);
printf("%x\n", flags);
}
- else
+ else
{
if (opt_verbose)
printf("key: %s\nflags: %x\nlength: %zu\nvalue: ",
@@ -91,7 +99,7 @@
}
else if (rc != MEMCACHED_NOTFOUND)
{
- fprintf(stderr, "memcat: %s: memcache error %s",
+ fprintf(stderr, "memcat: %s: memcache error %s",
argv[optind], memcached_strerror(memc, rc));
if (memc->cached_errno)
fprintf(stderr, " system error %s", strerror(memc->cached_errno));
@@ -115,6 +123,8 @@
if (opt_hash)
free(opt_hash);
+ shutdown_sasl();
+
return return_code;
}
@@ -139,10 +149,12 @@
{(OPTIONSTRING)"flag", no_argument, &opt_displayflag, OPT_FLAG},
{(OPTIONSTRING)"hash", required_argument, NULL, OPT_HASH},
{(OPTIONSTRING)"binary", no_argument, NULL, OPT_BINARY},
+ {(OPTIONSTRING)"username", required_argument, NULL, OPT_USERNAME},
+ {(OPTIONSTRING)"password", required_argument, NULL, OPT_PASSWD},
{0, 0, 0, 0},
};
- while (1)
+ while (1)
{
option_rv= getopt_long(argc, argv, "Vhvds:", long_options, &option_index);
if (option_rv == -1) break;
@@ -171,6 +183,12 @@
case OPT_HASH:
opt_hash= strdup(optarg);
break;
+ case OPT_USERNAME:
+ opt_username= optarg;
+ break;
+ case OPT_PASSWD:
+ opt_passwd= optarg;
+ break;
case '?':
/* getopt_long already printed an error message. */
exit(1);
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/clients/memcp.c
^
|
@@ -41,6 +41,8 @@
static int opt_method= OPT_SET;
static uint32_t opt_flags= 0;
static time_t opt_expires= 0;
+static char *opt_username;
+static char *opt_passwd;
static long strtol_wrapper(const char *nptr, int base, bool *error)
{
@@ -106,6 +108,11 @@
memcached_server_list_free(servers);
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL,
(uint64_t)opt_binary);
+ if (!initialize_sasl(memc, opt_username, opt_passwd))
+ {
+ memcached_free(memc);
+ return 1;
+ }
while (optind < argc)
{
@@ -193,6 +200,7 @@
free(opt_servers);
if (opt_hash)
free(opt_hash);
+ shutdown_sasl();
return return_code;
}
@@ -221,6 +229,8 @@
{(OPTIONSTRING)"replace", no_argument, NULL, OPT_REPLACE},
{(OPTIONSTRING)"hash", required_argument, NULL, OPT_HASH},
{(OPTIONSTRING)"binary", no_argument, NULL, OPT_BINARY},
+ {(OPTIONSTRING)"username", required_argument, NULL, OPT_USERNAME},
+ {(OPTIONSTRING)"password", required_argument, NULL, OPT_PASSWD},
{0, 0, 0, 0},
};
@@ -285,7 +295,13 @@
case OPT_HASH:
opt_hash= strdup(optarg);
break;
- case '?':
+ case OPT_USERNAME:
+ opt_username= optarg;
+ break;
+ case OPT_PASSWD:
+ opt_passwd= optarg;
+ break;
+ case '?':
/* getopt_long already printed an error message. */
exit(1);
default:
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/clients/memdump.c
^
|
@@ -38,6 +38,8 @@
static int opt_verbose= 0;
static char *opt_servers= NULL;
static char *opt_hash= NULL;
+static char *opt_username;
+static char *opt_passwd;
/* Print the keys and counter how many were found */
static memcached_return_t key_printer(const memcached_st *ptr __attribute__((unused)),
@@ -85,6 +87,11 @@
memcached_server_list_free(servers);
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL,
(uint64_t)opt_binary);
+ if (!initialize_sasl(memc, opt_username, opt_passwd))
+ {
+ memcached_free(memc);
+ return 1;
+ }
rc= memcached_dump(memc, callbacks, NULL, 1);
@@ -103,6 +110,8 @@
if (opt_hash)
free(opt_hash);
+ shutdown_sasl();
+
return 0;
}
@@ -120,6 +129,8 @@
{(OPTIONSTRING)"servers", required_argument, NULL, OPT_SERVERS},
{(OPTIONSTRING)"hash", required_argument, NULL, OPT_HASH},
{(OPTIONSTRING)"binary", no_argument, NULL, OPT_BINARY},
+ {(OPTIONSTRING)"username", required_argument, NULL, OPT_USERNAME},
+ {(OPTIONSTRING)"password", required_argument, NULL, OPT_PASSWD},
{0, 0, 0, 0}
};
@@ -154,6 +165,12 @@
case OPT_HASH:
opt_hash= strdup(optarg);
break;
+ case OPT_USERNAME:
+ opt_username= optarg;
+ break;
+ case OPT_PASSWD:
+ opt_passwd= optarg;
+ break;
case '?':
/* getopt_long already printed an error message. */
exit(1);
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/clients/memflush.c
^
|
@@ -22,6 +22,8 @@
static int opt_verbose= 0;
static time_t opt_expire= 0;
static char *opt_servers= NULL;
+static char *opt_username;
+static char *opt_passwd;
#define PROGRAM_NAME "memflush"
#define PROGRAM_DESCRIPTION "Erase all data in a server of memcached servers."
@@ -57,11 +59,17 @@
memcached_server_list_free(servers);
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL,
(uint64_t) opt_binary);
-
+
+ if (!initialize_sasl(memc, opt_username, opt_passwd))
+ {
+ memcached_free(memc);
+ return 1;
+ }
+
rc = memcached_flush(memc, opt_expire);
- if (rc != MEMCACHED_SUCCESS)
+ if (rc != MEMCACHED_SUCCESS)
{
- fprintf(stderr, "memflush: memcache error %s",
+ fprintf(stderr, "memflush: memcache error %s",
memcached_strerror(memc, rc));
if (memc->cached_errno)
fprintf(stderr, " system error %s", strerror(memc->cached_errno));
@@ -72,6 +80,8 @@
free(opt_servers);
+ shutdown_sasl();
+
return 0;
}
@@ -92,12 +102,14 @@
{(OPTIONSTRING)"servers", required_argument, NULL, OPT_SERVERS},
{(OPTIONSTRING)"expire", required_argument, NULL, OPT_EXPIRE},
{(OPTIONSTRING)"binary", no_argument, NULL, OPT_BINARY},
+ {(OPTIONSTRING)"username", required_argument, NULL, OPT_USERNAME},
+ {(OPTIONSTRING)"password", required_argument, NULL, OPT_PASSWD},
{0, 0, 0, 0},
};
int option_index= 0;
int option_rv;
- while (1)
+ while (1)
{
option_rv= getopt_long(argc, argv, "Vhvds:", long_options, &option_index);
if (option_rv == -1) break;
@@ -126,6 +138,12 @@
case OPT_EXPIRE: /* --expire */
opt_expire= (time_t)strtoll(optarg, (char **)NULL, 10);
break;
+ case OPT_USERNAME:
+ opt_username= optarg;
+ break;
+ case OPT_PASSWD:
+ opt_passwd= optarg;
+ break;
case '?':
/* getopt_long already printed an error message. */
exit(1);
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/clients/memrm.c
^
|
@@ -23,6 +23,8 @@
static time_t opt_expire= 0;
static char *opt_servers= NULL;
static char *opt_hash= NULL;
+static char *opt_username;
+static char *opt_passwd;
#define PROGRAM_NAME "memrm"
#define PROGRAM_DESCRIPTION "Erase a key or set of keys from a memcached cluster."
@@ -61,7 +63,13 @@
memcached_server_list_free(servers);
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL,
(uint64_t) opt_binary);
-
+
+ if (!initialize_sasl(memc, opt_username, opt_passwd))
+ {
+ memcached_free(memc);
+ return 1;
+ }
+
while (optind < argc)
{
if (opt_verbose)
@@ -89,6 +97,8 @@
if (opt_hash)
free(opt_hash);
+ shutdown_sasl();
+
return return_code;
}
@@ -110,6 +120,8 @@
{(OPTIONSTRING)"expire", required_argument, NULL, OPT_EXPIRE},
{(OPTIONSTRING)"hash", required_argument, NULL, OPT_HASH},
{(OPTIONSTRING)"binary", no_argument, NULL, OPT_BINARY},
+ {(OPTIONSTRING)"username", required_argument, NULL, OPT_USERNAME},
+ {(OPTIONSTRING)"password", required_argument, NULL, OPT_PASSWD},
{0, 0, 0, 0},
};
int option_index= 0;
@@ -147,6 +159,12 @@
case OPT_HASH:
opt_hash= strdup(optarg);
break;
+ case OPT_USERNAME:
+ opt_username= optarg;
+ break;
+ case OPT_PASSWD:
+ opt_passwd= optarg;
+ break;
case '?':
/* getopt_long already printed an error message. */
exit(1);
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/clients/memstat.c
^
|
@@ -33,13 +33,9 @@
/* Prototypes */
static void options_parse(int argc, char *argv[]);
-static void run_analyzer(memcached_st *memc, memcached_stat_st *memc_stat,
- memcached_server_st *server_list);
-static void print_server_listing(memcached_st *memc, memcached_stat_st *memc_stat,
- memcached_server_st *server_list);
+static void run_analyzer(memcached_st *memc, memcached_stat_st *memc_stat);
static void print_analysis_report(memcached_st *memc,
- memcached_analysis_st *report,
- memcached_server_st *server_list);
+ memcached_analysis_st *report);
static int opt_verbose= 0;
static int opt_displayflag= 0;
@@ -59,17 +55,50 @@
{0, 0, 0, 0},
};
+
+static memcached_return_t server_print_callback(const memcached_st *memc,
+ memcached_server_instance_st instance,
+ void *context)
+{
+ memcached_stat_st server_stat;
+ memcached_return_t rc;
+ char **list;
+ char **ptr;
+
+ (void)context;
+
+ rc= memcached_stat_servername(&server_stat, NULL,
+ memcached_server_name(instance),
+ memcached_server_port(instance));
+
+ list= memcached_stat_get_keys(memc, &server_stat, &rc);
+
+ printf("Server: %s (%u)\n", memcached_server_name(instance),
+ (uint32_t)memcached_server_port(instance));
+
+ for (ptr= list; *ptr; ptr++)
+ {
+ char *value= memcached_stat_get_value(memc, &server_stat, *ptr, &rc);
+
+ printf("\t %s: %s\n", *ptr, value);
+ free(value);
+ }
+
+ free(list);
+ printf("\n");
+
+ return MEMCACHED_SUCCESS;
+}
+
int main(int argc, char *argv[])
{
memcached_return_t rc;
memcached_st *memc;
- memcached_stat_st *memc_stat;
memcached_server_st *servers;
- memcached_server_st *server_list;
options_parse(argc, argv);
- if (!opt_servers)
+ if (! opt_servers)
{
char *temp;
@@ -86,11 +115,9 @@
memc= memcached_create(NULL);
servers= memcached_servers_parse(opt_servers);
- memcached_server_push(memc, servers);
+ rc= memcached_server_push(memc, servers);
memcached_server_list_free(servers);
- memc_stat= memcached_stat(memc, NULL, &rc);
-
if (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_SOME_ERRORS)
{
printf("Failure to communicate with servers (%s)\n",
@@ -98,23 +125,37 @@
exit(1);
}
- server_list= memcached_server_list(memc);
-
if (opt_analyze)
- run_analyzer(memc, memc_stat, server_list);
+ {
+ memcached_stat_st *memc_stat;
+
+ memc_stat= memcached_stat(memc, NULL, &rc);
+
+ if (! memc_stat)
+ exit(-1);
+
+ run_analyzer(memc, memc_stat);
+
+ memcached_stat_free(memc, memc_stat);
+ }
else
- print_server_listing(memc, memc_stat, server_list);
+ {
+ memcached_server_fn callbacks[1];
+
+ callbacks[0]= server_print_callback;
+ rc= memcached_server_cursor(memc, callbacks,
+ NULL, 1);
+
+ }
- free(memc_stat);
free(opt_servers);
memcached_free(memc);
- return 0;
+ return rc == MEMCACHED_SUCCESS ? 0: -1;
}
-static void run_analyzer(memcached_st *memc, memcached_stat_st *memc_stat,
- memcached_server_st *server_list)
+static void run_analyzer(memcached_st *memc, memcached_stat_st *memc_stat)
{
memcached_return_t rc;
@@ -128,13 +169,13 @@
memcached_strerror(memc, rc));
exit(1);
}
- print_analysis_report(memc, report, server_list);
+ print_analysis_report(memc, report);
free(report);
}
else if (strcmp(analyze_mode, "latency") == 0)
{
memcached_st **servers;
- uint32_t x, y, flags, server_count= memcached_server_count(memc);
+ uint32_t flags, server_count= memcached_server_count(memc);
uint32_t num_of_tests= 32;
const char *test_key= "libmemcached_test_key";
@@ -145,9 +186,12 @@
return;
}
- for (x= 0; x < server_count; x++)
+ for (uint32_t x= 0; x < server_count; x++)
{
- if((servers[x]= memcached_create(NULL)) == NULL)
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, x);
+
+ if ((servers[x]= memcached_create(NULL)) == NULL)
{
fprintf(stderr, "Failed to memcached_create()\n");
if (x > 0)
@@ -160,18 +204,22 @@
return;
}
memcached_server_add(servers[x],
- memcached_server_name(memc, server_list[x]),
- memcached_server_port(memc, server_list[x]));
+ memcached_server_name(instance),
+ memcached_server_port(instance));
}
printf("Network Latency Test:\n\n");
struct timeval start_time, end_time;
- long elapsed_time, slowest_time= 0, slowest_server= 0;
+ uint32_t slowest_server= 0;
+ long elapsed_time, slowest_time= 0;
- for (x= 0; x < server_count; x++)
+ for (uint32_t x= 0; x < server_count; x++)
{
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, x);
gettimeofday(&start_time, NULL);
- for (y= 0; y < num_of_tests; y++)
+
+ for (uint32_t y= 0; y < num_of_tests; y++)
{
size_t vlen;
char *val= memcached_get(servers[x], test_key, strlen(test_key),
@@ -187,36 +235,39 @@
if (elapsed_time > slowest_time)
{
- slowest_server= (long)x;
+ slowest_server= x;
slowest_time= elapsed_time;
}
if (rc != MEMCACHED_NOTFOUND && rc != MEMCACHED_SUCCESS)
{
printf("\t %s (%d) => failed to reach the server\n",
- memcached_server_name(memc, server_list[x]),
- memcached_server_port(memc, server_list[x]));
+ memcached_server_name(instance),
+ memcached_server_port(instance));
}
else
{
printf("\t %s (%d) => %ld.%ld seconds\n",
- memcached_server_name(memc, server_list[x]),
- memcached_server_port(memc, server_list[x]),
+ memcached_server_name(instance),
+ memcached_server_port(instance),
elapsed_time / 1000, elapsed_time % 1000);
}
}
if (server_count > 1 && slowest_time > 0)
{
+ memcached_server_instance_st slowest=
+ memcached_server_instance_by_position(memc, slowest_server);
+
printf("---\n");
printf("Slowest Server: %s (%d) => %ld.%ld seconds\n",
- memcached_server_name(memc, server_list[slowest_server]),
- memcached_server_port(memc, server_list[slowest_server]),
+ memcached_server_name(slowest),
+ memcached_server_port(slowest),
slowest_time / 1000, slowest_time % 1000);
}
printf("\n");
- for (x= 0; x < server_count; x++)
+ for (uint32_t x= 0; x < server_count; x++)
memcached_free(servers[x]);
free(servers);
@@ -229,40 +280,14 @@
}
}
-static void print_server_listing(memcached_st *memc, memcached_stat_st *memc_stat,
- memcached_server_st *server_list)
-{
- unsigned int x;
- memcached_return_t rc;
-
- printf("Listing %u Server\n\n", memcached_server_count(memc));
- for (x= 0; x < memcached_server_count(memc); x++)
- {
- char **list;
- char **ptr;
-
- list= memcached_stat_get_keys(memc, &memc_stat[x], &rc);
-
- printf("Server: %s (%u)\n", memcached_server_name(memc, server_list[x]),
- (uint32_t)memcached_server_port(memc, server_list[x]));
- for (ptr= list; *ptr; ptr++)
- {
- char *value= memcached_stat_get_value(memc, &memc_stat[x], *ptr, &rc);
-
- printf("\t %s: %s\n", *ptr, value);
- free(value);
- }
-
- free(list);
- printf("\n");
- }
-}
-
static void print_analysis_report(memcached_st *memc,
- memcached_analysis_st *report,
- memcached_server_st *server_list)
+ memcached_analysis_st *report)
+
{
uint32_t server_count= memcached_server_count(memc);
+ memcached_server_instance_st most_consumed_server= memcached_server_instance_by_position(memc, report->most_consumed_server);
+ memcached_server_instance_st least_free_server= memcached_server_instance_by_position(memc, report->least_free_server);
+ memcached_server_instance_st oldest_server= memcached_server_instance_by_position(memc, report->oldest_server);
printf("Memcached Cluster Analysis Report\n\n");
@@ -278,16 +303,16 @@
printf("\n");
printf("\tNode with most memory consumption : %s:%u (%llu bytes)\n",
- memcached_server_name(memc, server_list[report->most_consumed_server]),
- (uint32_t)memcached_server_port(memc, server_list[report->most_consumed_server]),
+ memcached_server_name(most_consumed_server),
+ (uint32_t)memcached_server_port(most_consumed_server),
(unsigned long long)report->most_used_bytes);
printf("\tNode with least free space : %s:%u (%llu bytes remaining)\n",
- memcached_server_name(memc, server_list[report->least_free_server]),
- (uint32_t)memcached_server_port(memc, server_list[report->least_free_server]),
+ memcached_server_name(least_free_server),
+ (uint32_t)memcached_server_port(least_free_server),
(unsigned long long)report->least_remaining_bytes);
printf("\tNode with longest uptime : %s:%u (%us)\n",
- memcached_server_name(memc, server_list[report->oldest_server]),
- (uint32_t)memcached_server_port(memc, server_list[report->oldest_server]),
+ memcached_server_name(oldest_server),
+ (uint32_t)memcached_server_port(oldest_server),
report->longest_uptime);
printf("\tPool-wide Hit Ratio : %1.f%%\n", report->pool_hit_ratio);
printf("\n");
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/clients/utilities.c
^
|
@@ -58,6 +58,8 @@
case OPT_BINARY: return("Switch to binary protocol.");
case OPT_ANALYZE: return("Analyze the provided servers.");
case OPT_UDP: return("Use UDP protocol when communicating with server.");
+ case OPT_USERNAME: return "Username to use for SASL authentication";
+ case OPT_PASSWD: return "Password to use for SASL authentication";
default: WATCHPOINT_ASSERT(0);
};
@@ -75,12 +77,12 @@
printf("\t%s\n\n", description);
printf("Current options. A '=' means the option takes a value.\n\n");
- for (x= 0; long_options[x].name; x++)
+ for (x= 0; long_options[x].name; x++)
{
const char *help_message;
- printf("\t --%s%c\n", long_options[x].name,
- long_options[x].has_arg ? '=' : ' ');
+ printf("\t --%s%c\n", long_options[x].name,
+ long_options[x].has_arg ? '=' : ' ');
if ((help_message= lookup_help(long_options[x].val)))
printf("\t\t%s\n", help_message);
}
@@ -122,3 +124,93 @@
}
}
+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+static char *username;
+static char *passwd;
+
+static int get_username(void *context, int id, const char **result,
+ unsigned int *len)
+{
+ (void)context;
+ if (!result || (id != SASL_CB_USER && id != SASL_CB_AUTHNAME))
+ return SASL_BADPARAM;
+
+ *result= username;
+ if (len)
+ *len= (username == NULL) ? 0 : (unsigned int)strlen(username);
+
+ return SASL_OK;
+}
+
+static int get_password(sasl_conn_t *conn, void *context, int id,
+ sasl_secret_t **psecret)
+{
+ (void)context;
+ static sasl_secret_t* x;
+
+ if (!conn || ! psecret || id != SASL_CB_PASS)
+ return SASL_BADPARAM;
+
+ if (passwd == NULL)
+ {
+ *psecret= NULL;
+ return SASL_OK;
+ }
+
+ size_t len= strlen(passwd);
+ x = realloc(x, sizeof(sasl_secret_t) + len);
+ if (!x)
+ return SASL_NOMEM;
+
+ x->len = len;
+ strcpy((void *)x->data, passwd);
+
+ *psecret = x;
+ return SASL_OK;
+}
+
+/* callbacks we support */
+static sasl_callback_t sasl_callbacks[] = {
+ {
+ SASL_CB_USER, &get_username, NULL
+ }, {
+ SASL_CB_AUTHNAME, &get_username, NULL
+ }, {
+ SASL_CB_PASS, &get_password, NULL
+ }, {
+ SASL_CB_LIST_END, NULL, NULL
+ }
+};
+#endif
+
+bool initialize_sasl(memcached_st *memc, char *user, char *password)
+{
+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+ if (user != NULL && password != NULL)
+ {
+ username= user;
+ passwd= password;
+
+ if (sasl_client_init(NULL) != SASL_OK)
+ {
+ fprintf(stderr, "Failed to initialize sasl library!\n");
+ return false;
+ }
+ memcached_set_sasl_callbacks(memc, sasl_callbacks);
+ }
+#else
+ (void)memc;
+ (void)user;
+ (void)password;
+#endif
+
+ return true;
+}
+
+void shutdown_sasl(void)
+{
+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+ if (username != NULL || passwd != NULL)
+ sasl_done();
+#endif
+}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/clients/utilities.h
^
|
@@ -35,7 +35,7 @@
typedef struct memcached_programs_help_st memcached_programs_help_st;
-struct memcached_programs_help_st
+struct memcached_programs_help_st
{
char *not_used_yet;
};
@@ -48,3 +48,5 @@
const struct option *long_options,
memcached_programs_help_st *options);
void process_hash_option(memcached_st *memc, char *opt_hash);
+bool initialize_sasl(memcached_st *memc, char *user, char *password);
+void shutdown_sasl(void);
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/config.h.in
^
|
@@ -103,6 +103,12 @@
/* Define to 1 if you have the `mtmalloc' library (-lmtmalloc). */
#undef HAVE_LIBMTMALLOC
+/* Define if you have the sasl library. */
+#undef HAVE_LIBSASL
+
+/* Define if you have the sasl2 library. */
+#undef HAVE_LIBSASL2
+
/* Define to 1 if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/configure
^
|
@@ -1,8 +1,8 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for libmemcached 0.38.
+# Generated by GNU Autoconf 2.63 for libmemcached 0.40.
#
-# Report bugs to <http://tangent.org/552/libmemcached.html>.
+# Report bugs to <http://libmemcached.org/>.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
@@ -745,9 +745,9 @@
# Identity of this package.
PACKAGE_NAME='libmemcached'
PACKAGE_TARNAME='libmemcached'
-PACKAGE_VERSION='0.38'
-PACKAGE_STRING='libmemcached 0.38'
-PACKAGE_BUGREPORT='http://tangent.org/552/libmemcached.html'
+PACKAGE_VERSION='0.40'
+PACKAGE_STRING='libmemcached 0.40'
+PACKAGE_BUGREPORT='http://libmemcached.org/'
ac_unique_file="libmemcached/memcached.c"
# Factoring default headers for most tests.
@@ -789,8 +789,21 @@
ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
-HASHKIT_BITFIELD
-MEMCACHED_BITFIELD
+LIBMEMCACHED_WITH_SASL_SUPPORT
+HAVE_SASL_FALSE
+HAVE_SASL_TRUE
+HAVE_LIBSASL2_FALSE
+HAVE_LIBSASL2_TRUE
+HAVE_LIBSASL_FALSE
+HAVE_LIBSASL_TRUE
+LIBSASL2_PREFIX
+LTLIBSASL2
+LIBSASL2
+HAVE_LIBSASL2
+LIBSASL_PREFIX
+LTLIBSASL
+LIBSASL
+HAVE_LIBSASL
HAVE_LIBINNODB_FALSE
HAVE_LIBINNODB_TRUE
LIBINNODB_PREFIX
@@ -1004,6 +1017,9 @@
enable_deprecated
enable_libinnodb
with_libinnodb_prefix
+enable_sasl
+with_libsasl_prefix
+with_libsasl2_prefix
'
ac_precious_vars='build_alias
host_alias
@@ -1570,7 +1586,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libmemcached 0.38 to adapt to many kinds of systems.
+\`configure' configures libmemcached 0.40 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1641,7 +1657,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libmemcached 0.38:";;
+ short | recursive ) echo "Configuration of libmemcached 0.40:";;
esac
cat <<\_ACEOF
@@ -1675,6 +1691,7 @@
@<:default=off]
--enable-deprecated Enable deprecated interface [default=off]
--disable-libinnodb Build with libinnodb support [default=on]
+ --disable-sasl Build with sasl support [default=on]
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1692,6 +1709,10 @@
--with-memcached Memcached binary to use for make test
--with-libinnodb-prefix[=DIR] search for libinnodb in DIR/include and DIR/lib
--without-libinnodb-prefix don't search for libinnodb in includedir and libdir
+ --with-libsasl-prefix[=DIR] search for libsasl in DIR/include and DIR/lib
+ --without-libsasl-prefix don't search for libsasl in includedir and libdir
+ --with-libsasl2-prefix[=DIR] search for libsasl2 in DIR/include and DIR/lib
+ --without-libsasl2-prefix don't search for libsasl2 in includedir and libdir
Some influential environment variables:
CC C compiler command
@@ -1709,7 +1730,7 @@
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
-Report bugs to <http://tangent.org/552/libmemcached.html>.
+Report bugs to <http://libmemcached.org/>.
_ACEOF
ac_status=$?
fi
@@ -1772,7 +1793,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libmemcached configure 0.38
+libmemcached configure 0.40
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1786,7 +1807,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libmemcached $as_me 0.38, which was
+It was created by libmemcached $as_me 0.40, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -5220,9 +5241,9 @@
{ $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
-## ------------------------------------------------------- ##
-## Report this to http://tangent.org/552/libmemcached.html ##
-## ------------------------------------------------------- ##
+## --------------------------------------- ##
+## Report this to http://libmemcached.org/ ##
+## --------------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
@@ -5972,13 +5993,13 @@
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:5975: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:5996: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:5978: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:5999: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:5981: output\"" >&5)
+ (eval echo "\"\$as_me:6002: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -7183,7 +7204,7 @@
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 7186 "configure"' > conftest.$ac_ext
+ echo '#line 7207 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -9260,11 +9281,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9263: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9284: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:9267: \$? = $ac_status" >&5
+ echo "$as_me:9288: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -9599,11 +9620,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9602: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9623: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:9606: \$? = $ac_status" >&5
+ echo "$as_me:9627: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -9704,11 +9725,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9707: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9728: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:9711: \$? = $ac_status" >&5
+ echo "$as_me:9732: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -9759,11 +9780,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9762: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9783: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:9766: \$? = $ac_status" >&5
+ echo "$as_me:9787: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -12562,7 +12583,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12565 "configure"
+#line 12586 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12658,7 +12679,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12661 "configure"
+#line 12682 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14678,11 +14699,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14681: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14702: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14685: \$? = $ac_status" >&5
+ echo "$as_me:14706: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -14777,11 +14798,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14780: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14801: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14784: \$? = $ac_status" >&5
+ echo "$as_me:14805: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -14829,11 +14850,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14832: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14853: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14836: \$? = $ac_status" >&5
+ echo "$as_me:14857: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -16746,9 +16767,9 @@
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
-## ------------------------------------------------------- ##
-## Report this to http://tangent.org/552/libmemcached.html ##
-## ------------------------------------------------------- ##
+## --------------------------------------- ##
+## Report this to http://libmemcached.org/ ##
+## --------------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
@@ -16990,9 +17011,9 @@
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
-## ------------------------------------------------------- ##
-## Report this to http://tangent.org/552/libmemcached.html ##
-## ------------------------------------------------------- ##
+## --------------------------------------- ##
+## Report this to http://libmemcached.org/ ##
+## --------------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
@@ -17208,7 +17229,7 @@
# Define the identity of the package.
PACKAGE='libmemcached'
- VERSION='0.38'
+ VERSION='0.40'
cat >>confdefs.h <<_ACEOF
@@ -17854,9 +17875,9 @@
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
-## ------------------------------------------------------- ##
-## Report this to http://tangent.org/552/libmemcached.html ##
-## ------------------------------------------------------- ##
+## --------------------------------------- ##
+## Report this to http://libmemcached.org/ ##
+## --------------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
@@ -21533,9 +21554,9 @@
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
-## ------------------------------------------------------- ##
-## Report this to http://tangent.org/552/libmemcached.html ##
-## ------------------------------------------------------- ##
+## --------------------------------------- ##
+## Report this to http://libmemcached.org/ ##
+## --------------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
@@ -23298,7 +23319,7 @@
#shared library versioning
-MEMCACHED_LIBRARY_VERSION=4:0:0
+MEMCACHED_LIBRARY_VERSION=5:0:0
# | | |
# +------+ | +---+
# | | |
@@ -26236,9 +26257,9 @@
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
-## ------------------------------------------------------- ##
-## Report this to http://tangent.org/552/libmemcached.html ##
-## ------------------------------------------------------- ##
+## --------------------------------------- ##
+## Report this to http://libmemcached.org/ ##
+## --------------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
@@ -26815,6 +26836,7 @@
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
+#include <inttypes.h>
#include "libmemcached/memcached/protocol_binary.h"
int
@@ -27721,9 +27743,9 @@
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
-## ------------------------------------------------------- ##
-## Report this to http://tangent.org/552/libmemcached.html ##
-## ------------------------------------------------------- ##
+## --------------------------------------- ##
+## Report this to http://libmemcached.org/ ##
+## --------------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
@@ -27979,9 +28001,9 @@
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
-## ------------------------------------------------------- ##
-## Report this to http://tangent.org/552/libmemcached.html ##
-## ------------------------------------------------------- ##
+## --------------------------------------- ##
+## Report this to http://libmemcached.org/ ##
+## --------------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
@@ -28130,9 +28152,9 @@
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
-## ------------------------------------------------------- ##
-## Report this to http://tangent.org/552/libmemcached.html ##
-## ------------------------------------------------------- ##
+## --------------------------------------- ##
+## Report this to http://libmemcached.org/ ##
+## --------------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
@@ -28371,214 +28393,1330 @@
- { $as_echo "$as_me:$LINENO: checking for working bitfield" >&5
-$as_echo_n "checking for working bitfield... " >&6; }
-if test "${ac_cv_have_bitfield+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
-
- ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
- save_CFLAGS="${CFLAGS}"
- CFLAGS="${AM_CFLAGS} ${NO_WERROR}"
- if test "$cross_compiling" = yes; then
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
+ # Check whether --enable-sasl was given.
+if test "${enable_sasl+set}" = set; then
+ enableval=$enable_sasl; ac_enable_sasl="$enableval"
else
- cat >conftest.$ac_ext <<_ACEOF
+ ac_enable_sasl="no"
+fi
- /* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdbool.h>
+ if test "x$ac_enable_sasl" = "xyes"; then
-int
-main ()
-{
- struct flags { bool b0:1; bool b1:1; bool b2:1; bool b3:1;
- bool b4:1; bool b5:1; bool b6:1; bool b7:1;
- } f = { .b0 = false, .b1 = false, .b2 = false, .b3 = false,
- .b4 = false, .b5 = false, .b6 = false, .b7 = false };
-
- f.b0 = true;
- f.b1 = false;
- f.b2 = true;
- f.b3 = false;
- f.b4 = true;
- f.b5 = false;
- f.b6 = true;
- f.b7 = false;
-
- if (f.b0 && !f.b1 && f.b2 && !f.b3 && f.b4 && !f.b5 && f.b6 && !f.b7) {
- return 0;
- }
- return 1;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_have_bitfield=yes
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-( exit $ac_status )
- ac_cv_have_bitfield=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_bitfield" >&5
-$as_echo "$ac_cv_have_bitfield" >&6; }
- CFLAGS=${save_CFLAGS}
- if test "x$ac_cv_have_bitfield" = "xyes"; then
- MEMCACHED_BITFIELD="#define MEMCACHED_BITFIELD :1"
- HASHKIT_BITFIELD="#define HASHKIT_BITFIELD :1"
+ use_additional=yes
+ if test "x$GCC" = "xyes" -a "x" = "xsystem"
+ then
+ i_system="-isystem "
+ else
+ i_system="-I"
+ fi
-else
- MEMCACHED_BITFIELD="#define MEMCACHED_BITFIELD"
- HASHKIT_BITFIELD="#define HASHKIT_BITFIELD"
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
-fi
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
- ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+# Check whether --with-libsasl-prefix was given.
+if test "${with_libsasl_prefix+set}" = set; then
+ withval=$with_libsasl_prefix;
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
-for ac_header in atomic.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ if test "$acl_libdirstem2" != "$acl_libdirstem" \
+ && ! test -d "$withval/$acl_libdirstem"; then
+ additional_libdir="$withval/$acl_libdirstem2"
+ fi
+ fi
+ fi
- ac_header_compiler=no
fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+ LIBSASL=
+ LTLIBSASL=
+ INCSASL=
+ LIBSASL_PREFIX=
+ rpathdirs=
+ ltrpathdirs=
+ names_already_handled=
+ names_next_round='sasl '
+ while test -n "$names_next_round"; do
+ names_this_round="$names_next_round"
+ names_next_round=
+ for name in $names_this_round; do
+ already_handled=
+ for n in $names_already_handled; do
+ if test "$n" = "$name"; then
+ already_handled=yes
+ break
+ fi
+ done
+ if test -z "$already_handled"; then
+ names_already_handled="$names_already_handled $name"
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+ eval value=\"\$HAVE_LIB$uppername\"
+ if test -n "$value"; then
+ if test "$value" = yes; then
+ eval value=\"\$LIB$uppername\"
+ test -z "$value" || LIBSASL="${LIBSASL}${LIBSASL:+ }$value"
+ eval value=\"\$LTLIB$uppername\"
+ test -z "$value" || LTLIBSASL="${LTLIBSASL}${LTLIBSASL:+ }$value"
+ else
+ :
+ fi
+ else
+ found_dir=
+ found_la=
+ found_so=
+ found_a=
+ eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
+ if test -n "$acl_shlibext"; then
+ shrext=".$acl_shlibext" # typically: shrext=.so
+ else
+ shrext=
+ fi
+ if test $use_additional = yes; then
+ dir="$additional_libdir"
+ if test -n "$acl_shlibext"; then
+ if test -f "$dir/$libname$shrext"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext"
+ else
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+ ver=`(cd "$dir" && \
+ for f in "$libname$shrext".*; do echo "$f"; done \
+ | sed -e "s,^$libname$shrext\\\\.,," \
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+ | sed 1q ) 2>/dev/null`
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext.$ver"
+ fi
+ else
+ eval library_names=\"$acl_library_names_spec\"
+ for f in $library_names; do
+ if test -f "$dir/$f"; then
+ found_dir="$dir"
+ found_so="$dir/$f"
+ break
+ fi
+ done
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ if test -f "$dir/$libname.$acl_libext"; then
+ found_dir="$dir"
+ found_a="$dir/$libname.$acl_libext"
+ fi
+ fi
+ if test "X$found_dir" != "X"; then
+ if test -f "$dir/$libname.la"; then
+ found_la="$dir/$libname.la"
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ for x in $LDFLAGS $LTLIBSASL; do
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ case "$x" in
+ -L*)
+ dir=`echo "X$x" | sed -e 's/^X-L//'`
+ if test -n "$acl_shlibext"; then
+ if test -f "$dir/$libname$shrext"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext"
+ else
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+ ver=`(cd "$dir" && \
+ for f in "$libname$shrext".*; do echo "$f"; done \
+ | sed -e "s,^$libname$shrext\\\\.,," \
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+ | sed 1q ) 2>/dev/null`
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext.$ver"
+ fi
+ else
+ eval library_names=\"$acl_library_names_spec\"
+ for f in $library_names; do
+ if test -f "$dir/$f"; then
+ found_dir="$dir"
+ found_so="$dir/$f"
+ break
+ fi
+ done
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ if test -f "$dir/$libname.$acl_libext"; then
+ found_dir="$dir"
+ found_a="$dir/$libname.$acl_libext"
+ fi
+ fi
+ if test "X$found_dir" != "X"; then
+ if test -f "$dir/$libname.la"; then
+ found_la="$dir/$libname.la"
+ fi
+ fi
+ ;;
+ esac
+ if test "X$found_dir" != "X"; then
+ break
+ fi
+ done
+ fi
+ if test "X$found_dir" != "X"; then
+ LTLIBSASL="${LTLIBSASL}${LTLIBSASL:+ }-L$found_dir -l$name"
+ if test "X$found_so" != "X"; then
+ if test "$enable_rpath" = no \
+ || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+ || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
+ LIBSASL="${LIBSASL}${LIBSASL:+ }$found_so"
+ else
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $found_dir"
+ fi
+ if test "$acl_hardcode_direct" = yes; then
+ LIBSASL="${LIBSASL}${LIBSASL:+ }$found_so"
+ else
+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+ LIBSASL="${LIBSASL}${LIBSASL:+ }$found_so"
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $found_dir"
+ fi
+ else
+ haveit=
+ for x in $LDFLAGS $LIBSASL; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ LIBSASL="${LIBSASL}${LIBSASL:+ }-L$found_dir"
+ fi
+ if test "$acl_hardcode_minus_L" != no; then
+ LIBSASL="${LIBSASL}${LIBSASL:+ }$found_so"
+ else
+ LIBSASL="${LIBSASL}${LIBSASL:+ }-l$name"
+ fi
+ fi
+ fi
+ fi
+ else
+ if test "X$found_a" != "X"; then
+ LIBSASL="${LIBSASL}${LIBSASL:+ }$found_a"
+ else
+ LIBSASL="${LIBSASL}${LIBSASL:+ }-L$found_dir -l$name"
+ fi
+ fi
+ additional_includedir=
+ case "$found_dir" in
+ */$acl_libdirstem | */$acl_libdirstem/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+ if test "$name" = 'sasl'; then
+ LIBSASL_PREFIX="$basedir"
+ fi
+ additional_includedir="$basedir/include"
+ ;;
+ */$acl_libdirstem2 | */$acl_libdirstem2/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+ if test "$name" = 'sasl'; then
+ LIBSASL_PREFIX="$basedir"
+ fi
+ additional_includedir="$basedir/include"
+ ;;
+ esac
+ if test "X$additional_includedir" != "X"; then
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ for x in $CPPFLAGS $INCSASL; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X${i_system}$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ INCSASL="${INCSASL}${INCSASL:+ }${i_system}$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ fi
+ if test -n "$found_la"; then
+ save_libdir="$libdir"
+ case "$found_la" in
+ */* | *\\*) . "$found_la" ;;
+ *) . "./$found_la" ;;
+ esac
+ libdir="$save_libdir"
+ for dep in $dependency_libs; do
+ case "$dep" in
+ -L*)
+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
+ && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
+ haveit=
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
+ || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ haveit=
+ for x in $LDFLAGS $LIBSASL; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ LIBSASL="${LIBSASL}${LIBSASL:+ }-L$additional_libdir"
+ fi
+ fi
+ haveit=
+ for x in $LDFLAGS $LTLIBSASL; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ LTLIBSASL="${LTLIBSASL}${LTLIBSASL:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ ;;
+ -R*)
+ dir=`echo "X$dep" | sed -e 's/^X-R//'`
+ if test "$enable_rpath" != no; then
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $dir"
+ fi
+ fi
+ ;;
+ -l*)
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+ ;;
+ *.la)
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+ ;;
+ *)
+ LIBSASL="${LIBSASL}${LIBSASL:+ }$dep"
+ LTLIBSASL="${LTLIBSASL}${LTLIBSASL:+ }$dep"
+ ;;
+ esac
+ done
+ fi
+ else
+ LIBSASL="${LIBSASL}${LIBSASL:+ }-l$name"
+ LTLIBSASL="${LTLIBSASL}${LTLIBSASL:+ }-l$name"
+ fi
+ fi
+ fi
+ done
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n "$acl_hardcode_libdir_separator"; then
+ alldirs=
+ for found_dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
+ done
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIBSASL="${LIBSASL}${LIBSASL:+ }$flag"
+ else
+ for found_dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$found_dir"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIBSASL="${LIBSASL}${LIBSASL:+ }$flag"
+ done
+ fi
+ fi
+ if test "X$ltrpathdirs" != "X"; then
+ for found_dir in $ltrpathdirs; do
+ LTLIBSASL="${LTLIBSASL}${LTLIBSASL:+ }-R$found_dir"
+ done
+ fi
+
+
+
+
+
+
+
+ ac_save_CPPFLAGS="$CPPFLAGS"
+
+ for element in $INCSASL; do
+ haveit=
+ for x in $CPPFLAGS; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X$element"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+ fi
+ done
+
+
+ { $as_echo "$as_me:$LINENO: checking for libsasl" >&5
+$as_echo_n "checking for libsasl... " >&6; }
+if test "${ac_cv_libsasl+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+
+ ac_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBSASL"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #include <stdlib.h>
+ #include <sasl/sasl.h>
+
+int
+main ()
+{
+
+ sasl_server_init(NULL, NULL);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_libsasl=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_libsasl=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS="$ac_save_LIBS"
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_libsasl" >&5
+$as_echo "$ac_cv_libsasl" >&6; }
+ if test "$ac_cv_libsasl" = yes; then
+ HAVE_LIBSASL=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBSASL 1
+_ACEOF
+
+ { $as_echo "$as_me:$LINENO: checking how to link with libsasl" >&5
+$as_echo_n "checking how to link with libsasl... " >&6; }
+ { $as_echo "$as_me:$LINENO: result: $LIBSASL" >&5
+$as_echo "$LIBSASL" >&6; }
+ else
+ HAVE_LIBSASL=no
+ CPPFLAGS="$ac_save_CPPFLAGS"
+ LIBSASL=
+ LTLIBSASL=
+ LIBSASL_PREFIX=
+ fi
+
+
+
+
+
+
+
+
+ if test "x${ac_cv_libsasl}" != "xyes" ; then
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ use_additional=yes
+ if test "x$GCC" = "xyes" -a "x" = "xsystem"
+ then
+ i_system="-isystem "
+ else
+ i_system="-I"
+ fi
+
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+
+# Check whether --with-libsasl2-prefix was given.
+if test "${with_libsasl2_prefix+set}" = set; then
+ withval=$with_libsasl2_prefix;
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ if test "$acl_libdirstem2" != "$acl_libdirstem" \
+ && ! test -d "$withval/$acl_libdirstem"; then
+ additional_libdir="$withval/$acl_libdirstem2"
+ fi
+ fi
+ fi
+
+fi
+
+ LIBSASL2=
+ LTLIBSASL2=
+ INCSASL2=
+ LIBSASL2_PREFIX=
+ rpathdirs=
+ ltrpathdirs=
+ names_already_handled=
+ names_next_round='sasl2 '
+ while test -n "$names_next_round"; do
+ names_this_round="$names_next_round"
+ names_next_round=
+ for name in $names_this_round; do
+ already_handled=
+ for n in $names_already_handled; do
+ if test "$n" = "$name"; then
+ already_handled=yes
+ break
+ fi
+ done
+ if test -z "$already_handled"; then
+ names_already_handled="$names_already_handled $name"
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+ eval value=\"\$HAVE_LIB$uppername\"
+ if test -n "$value"; then
+ if test "$value" = yes; then
+ eval value=\"\$LIB$uppername\"
+ test -z "$value" || LIBSASL2="${LIBSASL2}${LIBSASL2:+ }$value"
+ eval value=\"\$LTLIB$uppername\"
+ test -z "$value" || LTLIBSASL2="${LTLIBSASL2}${LTLIBSASL2:+ }$value"
+ else
+ :
+ fi
+ else
+ found_dir=
+ found_la=
+ found_so=
+ found_a=
+ eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
+ if test -n "$acl_shlibext"; then
+ shrext=".$acl_shlibext" # typically: shrext=.so
+ else
+ shrext=
+ fi
+ if test $use_additional = yes; then
+ dir="$additional_libdir"
+ if test -n "$acl_shlibext"; then
+ if test -f "$dir/$libname$shrext"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext"
+ else
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+ ver=`(cd "$dir" && \
+ for f in "$libname$shrext".*; do echo "$f"; done \
+ | sed -e "s,^$libname$shrext\\\\.,," \
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+ | sed 1q ) 2>/dev/null`
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext.$ver"
+ fi
+ else
+ eval library_names=\"$acl_library_names_spec\"
+ for f in $library_names; do
+ if test -f "$dir/$f"; then
+ found_dir="$dir"
+ found_so="$dir/$f"
+ break
+ fi
+ done
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ if test -f "$dir/$libname.$acl_libext"; then
+ found_dir="$dir"
+ found_a="$dir/$libname.$acl_libext"
+ fi
+ fi
+ if test "X$found_dir" != "X"; then
+ if test -f "$dir/$libname.la"; then
+ found_la="$dir/$libname.la"
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ for x in $LDFLAGS $LTLIBSASL2; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ case "$x" in
+ -L*)
+ dir=`echo "X$x" | sed -e 's/^X-L//'`
+ if test -n "$acl_shlibext"; then
+ if test -f "$dir/$libname$shrext"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext"
+ else
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+ ver=`(cd "$dir" && \
+ for f in "$libname$shrext".*; do echo "$f"; done \
+ | sed -e "s,^$libname$shrext\\\\.,," \
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+ | sed 1q ) 2>/dev/null`
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext.$ver"
+ fi
+ else
+ eval library_names=\"$acl_library_names_spec\"
+ for f in $library_names; do
+ if test -f "$dir/$f"; then
+ found_dir="$dir"
+ found_so="$dir/$f"
+ break
+ fi
+ done
+ fi
+ fi
+ fi
+ if test "X$found_dir" = "X"; then
+ if test -f "$dir/$libname.$acl_libext"; then
+ found_dir="$dir"
+ found_a="$dir/$libname.$acl_libext"
+ fi
+ fi
+ if test "X$found_dir" != "X"; then
+ if test -f "$dir/$libname.la"; then
+ found_la="$dir/$libname.la"
+ fi
+ fi
+ ;;
+ esac
+ if test "X$found_dir" != "X"; then
+ break
+ fi
+ done
+ fi
+ if test "X$found_dir" != "X"; then
+ LTLIBSASL2="${LTLIBSASL2}${LTLIBSASL2:+ }-L$found_dir -l$name"
+ if test "X$found_so" != "X"; then
+ if test "$enable_rpath" = no \
+ || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+ || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
+ LIBSASL2="${LIBSASL2}${LIBSASL2:+ }$found_so"
+ else
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $found_dir"
+ fi
+ if test "$acl_hardcode_direct" = yes; then
+ LIBSASL2="${LIBSASL2}${LIBSASL2:+ }$found_so"
+ else
+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+ LIBSASL2="${LIBSASL2}${LIBSASL2:+ }$found_so"
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $found_dir"
+ fi
+ else
+ haveit=
+ for x in $LDFLAGS $LIBSASL2; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ LIBSASL2="${LIBSASL2}${LIBSASL2:+ }-L$found_dir"
+ fi
+ if test "$acl_hardcode_minus_L" != no; then
+ LIBSASL2="${LIBSASL2}${LIBSASL2:+ }$found_so"
+ else
+ LIBSASL2="${LIBSASL2}${LIBSASL2:+ }-l$name"
+ fi
+ fi
+ fi
+ fi
+ else
+ if test "X$found_a" != "X"; then
+ LIBSASL2="${LIBSASL2}${LIBSASL2:+ }$found_a"
+ else
+ LIBSASL2="${LIBSASL2}${LIBSASL2:+ }-L$found_dir -l$name"
+ fi
+ fi
+ additional_includedir=
+ case "$found_dir" in
+ */$acl_libdirstem | */$acl_libdirstem/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+ if test "$name" = 'sasl2'; then
+ LIBSASL2_PREFIX="$basedir"
+ fi
+ additional_includedir="$basedir/include"
+ ;;
+ */$acl_libdirstem2 | */$acl_libdirstem2/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+ if test "$name" = 'sasl2'; then
+ LIBSASL2_PREFIX="$basedir"
+ fi
+ additional_includedir="$basedir/include"
+ ;;
+ esac
+ if test "X$additional_includedir" != "X"; then
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ for x in $CPPFLAGS $INCSASL2; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X${i_system}$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ INCSASL2="${INCSASL2}${INCSASL2:+ }${i_system}$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ fi
+ if test -n "$found_la"; then
+ save_libdir="$libdir"
+ case "$found_la" in
+ */* | *\\*) . "$found_la" ;;
+ *) . "./$found_la" ;;
+ esac
+ libdir="$save_libdir"
+ for dep in $dependency_libs; do
+ case "$dep" in
+ -L*)
+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
+ && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
+ haveit=
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
+ || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ haveit=
+ for x in $LDFLAGS $LIBSASL2; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ LIBSASL2="${LIBSASL2}${LIBSASL2:+ }-L$additional_libdir"
+ fi
+ fi
+ haveit=
+ for x in $LDFLAGS $LTLIBSASL2; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ LTLIBSASL2="${LTLIBSASL2}${LTLIBSASL2:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ ;;
+ -R*)
+ dir=`echo "X$dep" | sed -e 's/^X-R//'`
+ if test "$enable_rpath" != no; then
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $dir"
+ fi
+ fi
+ ;;
+ -l*)
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+ ;;
+ *.la)
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+ ;;
+ *)
+ LIBSASL2="${LIBSASL2}${LIBSASL2:+ }$dep"
+ LTLIBSASL2="${LTLIBSASL2}${LTLIBSASL2:+ }$dep"
+ ;;
+ esac
+ done
+ fi
+ else
+ LIBSASL2="${LIBSASL2}${LIBSASL2:+ }-l$name"
+ LTLIBSASL2="${LTLIBSASL2}${LTLIBSASL2:+ }-l$name"
+ fi
+ fi
+ fi
+ done
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n "$acl_hardcode_libdir_separator"; then
+ alldirs=
+ for found_dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
+ done
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIBSASL2="${LIBSASL2}${LIBSASL2:+ }$flag"
+ else
+ for found_dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$found_dir"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIBSASL2="${LIBSASL2}${LIBSASL2:+ }$flag"
+ done
+ fi
+ fi
+ if test "X$ltrpathdirs" != "X"; then
+ for found_dir in $ltrpathdirs; do
+ LTLIBSASL2="${LTLIBSASL2}${LTLIBSASL2:+ }-R$found_dir"
+ done
+ fi
+
+
+
+
+
+
+
+ ac_save_CPPFLAGS="$CPPFLAGS"
+
+ for element in $INCSASL2; do
+ haveit=
+ for x in $CPPFLAGS; do
+
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ eval x=\"$x\"
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+
+ if test "X$x" = "X$element"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+ fi
+ done
+
+
+ { $as_echo "$as_me:$LINENO: checking for libsasl2" >&5
+$as_echo_n "checking for libsasl2... " >&6; }
+if test "${ac_cv_libsasl2+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+
+ ac_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBSASL2"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #include <stdlib.h>
+ #include <sasl/sasl.h>
+
+int
+main ()
+{
+
+ sasl_server_init(NULL, NULL);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_libsasl2=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_libsasl2=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS="$ac_save_LIBS"
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_libsasl2" >&5
+$as_echo "$ac_cv_libsasl2" >&6; }
+ if test "$ac_cv_libsasl2" = yes; then
+ HAVE_LIBSASL2=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBSASL2 1
+_ACEOF
+
+ { $as_echo "$as_me:$LINENO: checking how to link with libsasl2" >&5
+$as_echo_n "checking how to link with libsasl2... " >&6; }
+ { $as_echo "$as_me:$LINENO: result: $LIBSASL2" >&5
+$as_echo "$LIBSASL2" >&6; }
+ else
+ HAVE_LIBSASL2=no
+ CPPFLAGS="$ac_save_CPPFLAGS"
+ LIBSASL2=
+ LTLIBSASL2=
+ LIBSASL2_PREFIX=
+ fi
+
+
+
+
+
+
+
+ HAVE_LIBSASL="$HAVE_LIBSASL2"
+ LIBSASL="$LIBSASL2"
+ LIBSASL_PREFIX="$LIBSASL2_PREFIX"
+ LTLIBSASL="$LT_LIBSASL2"
+
+fi
+
+
+fi
+
+
+ if test "x${ac_cv_libsasl}" = "xyes" -o "x${ac_cv_libsasl2}" = "xyes"; then
+ ac_cv_sasl=yes
+else
+ ac_cv_sasl=no
+fi
+
+
+ if test "x${ac_cv_libsasl}" = "xyes"; then
+ HAVE_LIBSASL_TRUE=
+ HAVE_LIBSASL_FALSE='#'
+else
+ HAVE_LIBSASL_TRUE='#'
+ HAVE_LIBSASL_FALSE=
+fi
+
+ if test "x${ac_cv_libsasl2}" = "xyes"; then
+ HAVE_LIBSASL2_TRUE=
+ HAVE_LIBSASL2_FALSE='#'
+else
+ HAVE_LIBSASL2_TRUE='#'
+ HAVE_LIBSASL2_FALSE=
+fi
+
+ if test "x${ac_cv_sasl}" = "xyes"; then
+ HAVE_SASL_TRUE=
+ HAVE_SASL_FALSE='#'
+else
+ HAVE_SASL_TRUE='#'
+ HAVE_SASL_FALSE=
+fi
+
+
+
+
+
+
+if test "x$ac_cv_sasl" = "xyes"; then
+ LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 1"
+fi
+
+
+
+
+for ac_header in atomic.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
@@ -28621,9 +29759,9 @@
{ $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
-## ------------------------------------------------------- ##
-## Report this to http://tangent.org/552/libmemcached.html ##
-## ------------------------------------------------------- ##
+## --------------------------------------- ##
+## Report this to http://libmemcached.org/ ##
+## --------------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
@@ -29053,6 +30191,27 @@
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${HAVE_LIBSASL_TRUE}" && test -z "${HAVE_LIBSASL_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_LIBSASL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"HAVE_LIBSASL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${HAVE_LIBSASL2_TRUE}" && test -z "${HAVE_LIBSASL2_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_LIBSASL2\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"HAVE_LIBSASL2\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${HAVE_SASL_TRUE}" && test -z "${HAVE_SASL_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_SASL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"HAVE_SASL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
: ${CONFIG_STATUS=./config.status}
ac_write_fail=0
@@ -29375,7 +30534,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libmemcached $as_me 0.38, which was
+This file was extended by libmemcached $as_me 0.40, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -29438,7 +30597,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-libmemcached config.status 0.38
+libmemcached config.status 0.40
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/configure.ac
^
|
@@ -7,7 +7,7 @@
# the COPYING file in this directory for full text.
AC_PREREQ(2.59)
-AC_INIT([libmemcached],[0.38],[http://tangent.org/552/libmemcached.html])
+AC_INIT([libmemcached],[0.40],[http://libmemcached.org/])
AC_CONFIG_SRCDIR([libmemcached/memcached.c])
AC_CONFIG_AUX_DIR(config)
AM_CONFIG_HEADER([config.h])
@@ -16,7 +16,7 @@
PANDORA_CANONICAL_TARGET
#shared library versioning
-MEMCACHED_LIBRARY_VERSION=4:0:0
+MEMCACHED_LIBRARY_VERSION=5:0:0
# | | |
# +------+ | +---+
# | | |
@@ -54,7 +54,12 @@
ENABLE_DEPRECATED
PANDORA_HAVE_LIBINNODB
PANDORA_PRINT_CALLSTACK
-DETECT_BITFIELD
+PANDORA_HAVE_SASL
+
+dnl The sasl functions should only be visible if we build with sasl support
+AS_IF([test "x$ac_cv_sasl" = "xyes"],
+ [LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 1"])
+AC_SUBST(LIBMEMCACHED_WITH_SASL_SUPPORT)
AC_CHECK_HEADERS([atomic.h])
AS_IF([test "x$ac_cv_header_atomic_h" = "xyes"],[
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/docs/Makefile.am
^
|
@@ -89,7 +89,7 @@
memcached_pool_create.pop \
memcached_pool_destroy.pop \
memcached_pool_pop.pop \
- memcached_pool_push.pop
+ memcached_pool_push.pop
BUILT_SOURCES += ${POOL_PAGES}
RESULT_PAGES= \
@@ -111,14 +111,14 @@
memcached_server_list.pop \
memcached_server_add.pop \
memcached_server_add_unix_socket.pop \
- memcached_server_push.pop
+ memcached_server_push.pop
BUILT_SOURCES += ${SERVER_PAGES}
SERVER_ST_PAGES= \
memcached_server_list_free.pop \
memcached_server_list_count.pop \
memcached_server_list_append.pop \
- memcached_servers_parse.pop
+ memcached_servers_parse.pop
BUILT_SOURCES += ${SERVER_ST_PAGES}
SET_PAGES= \
@@ -416,6 +416,34 @@
memslap.1 \
memstat.1
+if HAVE_SASL
+POD_FILES+= memcached_sasl.pod
+man_MANS+= \
+ memcached_destroy_sasl_auth_data.3 \
+ memcached_get_sasl_callbacks.3 \
+ memcached_sasl_set_auth_data.3 \
+ memcached_set_sasl_callbacks.3
+
+HTML_FILES+= \
+ memcached_destroy_sasl_auth_data.html \
+ memcached_get_sasl_callbacks.html \
+ memcached_sasl_set_auth_data.html \
+ memcached_set_sasl_callbacks.html
+
+
+SASL_PAGES= \
+ memcached_destroy_sasl_auth_data.pop \
+ memcached_get_sasl_callbacks.pop \
+ memcached_sasl_set_auth_data.pop \
+ memcached_set_sasl_callbacks.pop
+BUILT_SOURCES += ${SASL_PAGES}
+
+${SASL_PAGES}:
+ @rm -f $@
+ ln -s ${top_srcdir}/docs/memcached_sasl.pod ${top_builddir}/docs/$@
+
+endif
+
if BUILD_LIBMEMCACHEDUTIL
man_MANS+= \
libmemcachedutil.3 \
@@ -428,11 +456,11 @@
endif
-${CREATE_PAGES}:
+${CREATE_PAGES}:
@rm -f $@
ln -s ${top_srcdir}/docs/memcached_create.pod ${top_builddir}/docs/$@
-${SET_PAGES}:
+${SET_PAGES}:
@rm -f $@
ln -s ${top_srcdir}/docs/memcached_set.pod ${top_builddir}/docs/$@
@@ -488,7 +516,6 @@
@rm -f $@
ln -s ${top_srcdir}/docs/memcached_user_data.pod ${top_builddir}/docs/$@
-
${POOL_PAGES}:
@rm -f $@
ln -s ${top_srcdir}/docs/memcached_pool.pod ${top_builddir}/docs/$@
@@ -511,7 +538,7 @@
html-local: html-pages html-index
-html-pages: $(HTML_FILES)
+html-pages: $(HTML_FILES)
html-index: html-pages
perl make_index.pl *.html > index.html
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/docs/Makefile.in
^
|
@@ -34,7 +34,21 @@
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-@BUILD_LIBMEMCACHEDUTIL_TRUE@am__append_1 = \
+@HAVE_SASL_TRUE@am__append_1 = memcached_sasl.pod
+@HAVE_SASL_TRUE@am__append_2 = \
+@HAVE_SASL_TRUE@ memcached_destroy_sasl_auth_data.3 \
+@HAVE_SASL_TRUE@ memcached_get_sasl_callbacks.3 \
+@HAVE_SASL_TRUE@ memcached_sasl_set_auth_data.3 \
+@HAVE_SASL_TRUE@ memcached_set_sasl_callbacks.3
+
+@HAVE_SASL_TRUE@am__append_3 = \
+@HAVE_SASL_TRUE@ memcached_destroy_sasl_auth_data.html \
+@HAVE_SASL_TRUE@ memcached_get_sasl_callbacks.html \
+@HAVE_SASL_TRUE@ memcached_sasl_set_auth_data.html \
+@HAVE_SASL_TRUE@ memcached_set_sasl_callbacks.html
+
+@HAVE_SASL_TRUE@am__append_4 = ${SASL_PAGES}
+@BUILD_LIBMEMCACHEDUTIL_TRUE@am__append_5 = \
@BUILD_LIBMEMCACHEDUTIL_TRUE@ libmemcachedutil.3 \
@BUILD_LIBMEMCACHEDUTIL_TRUE@ memcached_pool_behavior_set.3 \
@BUILD_LIBMEMCACHEDUTIL_TRUE@ memcached_pool_behavior_get.3 \
@@ -48,8 +62,8 @@
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_cxx_compile_stdcxx_0x.m4 \
$(top_srcdir)/m4/ac_cxx_header_stdcxx_98.m4 \
- $(top_srcdir)/m4/acx_pthread.m4 $(top_srcdir)/m4/bitfield.m4 \
- $(top_srcdir)/m4/byteorder.m4 $(top_srcdir)/m4/deprecated.m4 \
+ $(top_srcdir)/m4/acx_pthread.m4 $(top_srcdir)/m4/byteorder.m4 \
+ $(top_srcdir)/m4/deprecated.m4 \
$(top_srcdir)/m4/enable_utillib.m4 $(top_srcdir)/m4/hsieh.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
@@ -74,6 +88,7 @@
$(top_srcdir)/m4/pandora_platform.m4 \
$(top_srcdir)/m4/pandora_print_callstack.m4 \
$(top_srcdir)/m4/pandora_pthread.m4 \
+ $(top_srcdir)/m4/pandora_sasl.m4 \
$(top_srcdir)/m4/pandora_shared_ptr.m4 \
$(top_srcdir)/m4/pandora_stack_direction.m4 \
$(top_srcdir)/m4/pandora_use_pipe.m4 \
@@ -169,10 +184,11 @@
FGREP = @FGREP@
GCOV_LIBS = @GCOV_LIBS@
GREP = @GREP@
-HASHKIT_BITFIELD = @HASHKIT_BITFIELD@
HASHKIT_LIBRARY_VERSION = @HASHKIT_LIBRARY_VERSION@
HAVE_LIBEVENT = @HAVE_LIBEVENT@
HAVE_LIBINNODB = @HAVE_LIBINNODB@
+HAVE_LIBSASL = @HAVE_LIBSASL@
+HAVE_LIBSASL2 = @HAVE_LIBSASL2@
HAVE_VISIBILITY = @HAVE_VISIBILITY@
INNOBASE_SKIP_WARNINGS = @INNOBASE_SKIP_WARNINGS@
INSTALL = @INSTALL@
@@ -188,16 +204,22 @@
LIBEVENT_PREFIX = @LIBEVENT_PREFIX@
LIBINNODB = @LIBINNODB@
LIBINNODB_PREFIX = @LIBINNODB_PREFIX@
+LIBMEMCACHED_WITH_SASL_SUPPORT = @LIBMEMCACHED_WITH_SASL_SUPPORT@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSASL = @LIBSASL@
+LIBSASL2 = @LIBSASL2@
+LIBSASL2_PREFIX = @LIBSASL2_PREFIX@
+LIBSASL_PREFIX = @LIBSASL_PREFIX@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBEVENT = @LTLIBEVENT@
LTLIBINNODB = @LTLIBINNODB@
LTLIBOBJS = @LTLIBOBJS@
+LTLIBSASL = @LTLIBSASL@
+LTLIBSASL2 = @LTLIBSASL2@
MAKEINFO = @MAKEINFO@
-MEMCACHED_BITFIELD = @MEMCACHED_BITFIELD@
MEMCACHED_LIBRARY_VERSION = @MEMCACHED_LIBRARY_VERSION@
MEMC_BINARY = @MEMC_BINARY@
MKDIR_P = @MKDIR_P@
@@ -312,7 +334,7 @@
${MEMORY_ALLOCATORS_PAGES} ${POOL_PAGES} ${RESULT_PAGES} \
${SERVER_PAGES} ${SERVER_ST_PAGES} ${SET_PAGES} ${STATS_PAGES} \
${USER_DATA_PAGES} ${VERSION_PAGES} ${HASHKIT_CREATE_PAGES} \
- ${HASHKIT_FUNCTIONS_PAGES} ${HASHKIT_ST_PAGES}
+ ${HASHKIT_FUNCTIONS_PAGES} ${HASHKIT_ST_PAGES} $(am__append_4)
EXTRA_DIST = make_index.pl $(POD_FILES)
AUTO_PAGES = \
memcached_increment.pop \
@@ -382,7 +404,7 @@
memcached_pool_create.pop \
memcached_pool_destroy.pop \
memcached_pool_pop.pop \
- memcached_pool_push.pop
+ memcached_pool_push.pop
RESULT_PAGES = \
memcached_result_cas.pop \
@@ -401,13 +423,13 @@
memcached_server_list.pop \
memcached_server_add.pop \
memcached_server_add_unix_socket.pop \
- memcached_server_push.pop
+ memcached_server_push.pop
SERVER_ST_PAGES = \
memcached_server_list_free.pop \
memcached_server_list_count.pop \
memcached_server_list_append.pop \
- memcached_servers_parse.pop
+ memcached_servers_parse.pop
SET_PAGES = \
memcached_set.pop \
@@ -462,151 +484,71 @@
HASHKIT_ST_PAGES = \
hashkit_value.pop
-HTML_FILES = \
- hashkit_clone.html \
- hashkit_crc32.html \
- hashkit_create.html \
- hashkit_fnv1_32.html \
- hashkit_fnv1_64.html \
- hashkit_fnv1a_32.html \
- hashkit_fnv1a_64.html \
- hashkit_free.html \
- hashkit_functions.html \
- hashkit_hsieh.html \
- hashkit_is_allocated.html \
- hashkit_jenkins.html \
- hashkit_md5.html \
- hashkit_murmur.html \
- hashkit_value.html \
- libmemcached_examples.html \
- libmemcached.html \
- libmemcachedutil.html \
- memcached_add_by_key.html \
- memcached_add.html \
- memcached_analyze.html \
- memcached_append_by_key.html \
- memcached_append.html \
- memcached_behavior_get.html \
- memcached_behavior_set.html \
- memcached_callback_get.html \
- memcached_callback_set.html \
- memcached_cas_by_key.html \
- memcached_cas.html \
- memcached_clone.html \
- memcached_create.html \
- memcached_decrement.html \
- memcached_decrement_with_initial.html \
- memcached_delete_by_key.html \
- memcached_delete.html \
- memcached_dump.html \
- memcached_fetch_execute.html \
- memcached_fetch.html \
- memcached_fetch_result.html \
- memcached_flush_buffers.html \
- memcached_flush.html \
- memcached_free.html \
- memcached_generate_hash_value.html \
- memcached_get_by_key.html \
- memcached_get_memory_allocators.html \
- memcached_get.html \
- memcached_get_user_data.html \
- memcached_increment.html \
- memcached_increment_with_initial.html \
- memcached_lib_version.html \
- memcached_mget_by_key.html \
- memcached_mget_execute_by_key.html \
- memcached_mget_execute.html \
- memcached_mget.html \
- memcached_pool_behavior_get.html \
- memcached_pool_behavior_set.html \
- memcached_pool_create.html \
- memcached_pool_destroy.html \
- memcached_pool_pop.html \
- memcached_pool_push.html \
- memcached_prepend_by_key.html \
- memcached_prepend.html \
- memcached_quit.html \
- memcached_replace_by_key.html \
- memcached_replace.html \
- memcached_result_cas.html \
- memcached_result_create.html \
- memcached_result_flags.html \
- memcached_result_free.html \
- memcached_result_key_length.html \
- memcached_result_key_value.html \
- memcached_result_length.html \
- memcached_result_st.html \
- memcached_result_value.html \
- memcached_server_add.html \
- memcached_server_add_unix_socket.html \
- memcached_server_count.html \
- memcached_server_cursor.html \
- memcached_server_list_append.html \
- memcached_server_list_count.html \
- memcached_server_list_free.html \
- memcached_server_list.html \
- memcached_server_push.html \
- memcached_servers_parse.html \
- memcached_set_by_key.html \
- memcached_set_memory_allocators.html \
- memcached_set.html \
- memcached_set_user_data.html \
- memcached_stat_get_keys.html \
- memcached_stat_get_value.html \
- memcached_stat.html \
- memcached_stat_servername.html \
- memcached_strerror.html \
- memcached_verbosity.html \
- memcached_version.html \
- memcapable.html \
- memcat.html \
- memcp.html \
- memdump.html \
- memerror.html \
- memflush.html \
- memrm.html \
- memslap.html \
- memstat.html
-
-POD_FILES = \
- hashkit_create.pod \
- hashkit_functions.pod \
- hashkit_value.pod \
- libmemcached.pod \
- libmemcached_examples.pod \
- libmemcachedutil.pod \
- memcached_analyze.pod \
- memcached_auto.pod \
- memcached_behavior.pod \
- memcached_callback.pod \
- memcached_create.pod \
- memcached_delete.pod \
- memcached_dump.pod \
- memcached_flush.pod \
- memcached_flush_buffers.pod \
- memcached_generate_hash_value.pod \
- memcached_get.pod \
- memcached_memory_allocators.pod \
- memcached_pool.pod \
- memcached_quit.pod \
- memcached_server_st.pod \
- memcached_servers.pod \
- memcached_set.pod \
- memcached_stats.pod \
- memcached_strerror.pod \
- memcached_user_data.pod \
- memcached_verbosity.pod \
- memcached_version.pod \
- memcapable.pod \
- memcat.pod \
- memcp.pod \
- memdump.pod \
- memerror.pod \
- memflush.pod \
- memrm.pod \
- memslap.pod \
- memstat.pod
-
+HTML_FILES = hashkit_clone.html hashkit_crc32.html hashkit_create.html \
+ hashkit_fnv1_32.html hashkit_fnv1_64.html \
+ hashkit_fnv1a_32.html hashkit_fnv1a_64.html hashkit_free.html \
+ hashkit_functions.html hashkit_hsieh.html \
+ hashkit_is_allocated.html hashkit_jenkins.html \
+ hashkit_md5.html hashkit_murmur.html hashkit_value.html \
+ libmemcached_examples.html libmemcached.html \
+ libmemcachedutil.html memcached_add_by_key.html \
+ memcached_add.html memcached_analyze.html \
+ memcached_append_by_key.html memcached_append.html \
+ memcached_behavior_get.html memcached_behavior_set.html \
+ memcached_callback_get.html memcached_callback_set.html \
+ memcached_cas_by_key.html memcached_cas.html \
+ memcached_clone.html memcached_create.html \
+ memcached_decrement.html memcached_decrement_with_initial.html \
+ memcached_delete_by_key.html memcached_delete.html \
+ memcached_dump.html memcached_fetch_execute.html \
+ memcached_fetch.html memcached_fetch_result.html \
+ memcached_flush_buffers.html memcached_flush.html \
+ memcached_free.html memcached_generate_hash_value.html \
+ memcached_get_by_key.html memcached_get_memory_allocators.html \
+ memcached_get.html memcached_get_user_data.html \
+ memcached_increment.html memcached_increment_with_initial.html \
+ memcached_lib_version.html memcached_mget_by_key.html \
+ memcached_mget_execute_by_key.html memcached_mget_execute.html \
+ memcached_mget.html memcached_pool_behavior_get.html \
+ memcached_pool_behavior_set.html memcached_pool_create.html \
+ memcached_pool_destroy.html memcached_pool_pop.html \
+ memcached_pool_push.html memcached_prepend_by_key.html \
+ memcached_prepend.html memcached_quit.html \
+ memcached_replace_by_key.html memcached_replace.html \
+ memcached_result_cas.html memcached_result_create.html \
+ memcached_result_flags.html memcached_result_free.html \
+ memcached_result_key_length.html \
+ memcached_result_key_value.html memcached_result_length.html \
+ memcached_result_st.html memcached_result_value.html \
+ memcached_server_add.html \
+ memcached_server_add_unix_socket.html \
+ memcached_server_count.html memcached_server_cursor.html \
+ memcached_server_list_append.html \
+ memcached_server_list_count.html \
+ memcached_server_list_free.html memcached_server_list.html \
+ memcached_server_push.html memcached_servers_parse.html \
+ memcached_set_by_key.html memcached_set_memory_allocators.html \
+ memcached_set.html memcached_set_user_data.html \
+ memcached_stat_get_keys.html memcached_stat_get_value.html \
+ memcached_stat.html memcached_stat_servername.html \
+ memcached_strerror.html memcached_verbosity.html \
+ memcached_version.html memcapable.html memcat.html memcp.html \
+ memdump.html memerror.html memflush.html memrm.html \
+ memslap.html memstat.html $(am__append_3)
+POD_FILES = hashkit_create.pod hashkit_functions.pod hashkit_value.pod \
+ libmemcached.pod libmemcached_examples.pod \
+ libmemcachedutil.pod memcached_analyze.pod memcached_auto.pod \
+ memcached_behavior.pod memcached_callback.pod \
+ memcached_create.pod memcached_delete.pod memcached_dump.pod \
+ memcached_flush.pod memcached_flush_buffers.pod \
+ memcached_generate_hash_value.pod memcached_get.pod \
+ memcached_memory_allocators.pod memcached_pool.pod \
+ memcached_quit.pod memcached_server_st.pod \
+ memcached_servers.pod memcached_set.pod memcached_stats.pod \
+ memcached_strerror.pod memcached_user_data.pod \
+ memcached_verbosity.pod memcached_version.pod memcapable.pod \
+ memcat.pod memcp.pod memdump.pod memerror.pod memflush.pod \
+ memrm.pod memslap.pod memstat.pod $(am__append_1)
man_MANS = hashkit_clone.3 hashkit_crc32.3 hashkit_create.3 \
hashkit_fnv1_32.3 hashkit_fnv1_64.3 hashkit_fnv1a_32.3 \
hashkit_fnv1a_64.3 hashkit_free.3 hashkit_functions.3 \
@@ -642,7 +584,13 @@
memcached_stat_servername.3 memcached_strerror.3 \
memcached_verbosity.3 memcached_version.3 memcapable.1 \
memcat.1 memcp.1 memdump.1 memerror.1 memflush.1 memrm.1 \
- memslap.1 memstat.1 $(am__append_1)
+ memslap.1 memstat.1 $(am__append_2) $(am__append_5)
+@HAVE_SASL_TRUE@SASL_PAGES = \
+@HAVE_SASL_TRUE@ memcached_destroy_sasl_auth_data.pop \
+@HAVE_SASL_TRUE@ memcached_get_sasl_callbacks.pop \
+@HAVE_SASL_TRUE@ memcached_sasl_set_auth_data.pop \
+@HAVE_SASL_TRUE@ memcached_set_sasl_callbacks.pop
+
SUFFIXES = .pop .pod .html .1 .3
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -931,11 +879,15 @@
uninstall-man3
-${CREATE_PAGES}:
+@HAVE_SASL_TRUE@${SASL_PAGES}:
+@HAVE_SASL_TRUE@ @rm -f $@
+@HAVE_SASL_TRUE@ ln -s ${top_srcdir}/docs/memcached_sasl.pod ${top_builddir}/docs/$@
+
+${CREATE_PAGES}:
@rm -f $@
ln -s ${top_srcdir}/docs/memcached_create.pod ${top_builddir}/docs/$@
-${SET_PAGES}:
+${SET_PAGES}:
@rm -f $@
ln -s ${top_srcdir}/docs/memcached_set.pod ${top_builddir}/docs/$@
@@ -1012,7 +964,7 @@
html-local: html-pages html-index
-html-pages: $(HTML_FILES)
+html-pages: $(HTML_FILES)
html-index: html-pages
perl make_index.pl *.html > index.html
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/docs/memcached_behavior.pod
^
|
@@ -211,11 +211,11 @@
=item MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ
-Allows randomizing the replica reads starting point. Normally the read is
+Allows randomizing the replica reads starting point. Normally the read is
done from primary server and in case of miss the read is done from primary
-+ 1, then primary + 2 all the way to 'n' replicas. If this option is set
++ 1, then primary + 2 all the way to 'n' replicas. If this option is set
on the starting point of the replica reads is randomized between the servers.
-This allows distributing read load to multiple servers with the expense of
+This allows distributing read load to multiple servers with the expense of
more write traffic.
=item MEMCACHED_BEHAVIOR_CORK
@@ -224,9 +224,16 @@
MEMCACHED_NO_SERVERS is returned if no servers are available to test with.
MEMCACHED_NOT_SUPPORTED is returned if we were not able to determine
if support was available. All other responses then MEMCACHED_SUCCESS
-report an error of some sort. This behavior also enables
+report an error of some sort. This behavior also enables
MEMCACHED_BEHAVIOR_TCP_NODELAY when set.
+=item MEMCACHED_BEHAVIOR_KEEPALIVE
+
+Enable TCP_KEEPALIVE behavior.
+
+=item MEMCACHED_BEHAVIOR_KEEPALIVE_IDLE
+
+Specify time, in seconds, to mark a connection as idle. This is only available as an option Linux.
=item MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
@@ -240,6 +247,21 @@
occured or no hosts were available. It is safe to assume system default
if this occurs.
+=item MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
+
+This number of times a host can have an error before it is disabled.
+
+=item MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS
+
+If enabled any hosts which have been flagged as disabled will be removed
+from the list of servers in the memcached_st structure. This must be used
+in combination with MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT.
+
+=item MEMCACHED_BEHAVIOR_RETRY_TIMEOUT
+
+When enabled a host which is problematic will only be checked for usage
+based on the amount of time set by this behavior.
+
=back
=head1 RETURN
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/docs/memcached_delete.pod
^
|
@@ -23,15 +23,18 @@
=head1 DESCRIPTION
-memcached_delete() is used to delete a particular key. An expiration value
-can be applied so that the key is deleted after that many seconds, but this
-will only work if you are using a 1.2.x server. If you are using a 1.2.x
-server and you want to use the expiration value, please call memcached_version
-one time for the memcached_st instance. If you don't do this no-reply and
-buffered mode will be disabled to avoid getting out of sync with the server.
+memcached_delete() is used to delete a particular key.
memcached_delete_by_key() works the same, but it takes a master key to
find the given value.
+Expiration works by placing the item into a delete queue, which means that
+it won't possible to retrieve it by the "get" command, but "add" and
+"replace" command with this key will also fail (the "set" command will
+succeed, however). After the time passes, the item is finally deleted from server memory.
+
+Please note the the Danga memcached server removed support for expiration in
+the 1.4 version.
+
=head1 RETURN
A value of type C<memcached_return_t> is returned
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/docs/memcached_server_st.pod
^
|
@@ -11,21 +11,25 @@
#include <memcached.h>
- void memcached_server_list_free (memcached_server_st *ptr);
+ const memcached_server_instance_st
+ memcached_server_list (memcached_st *ptr);
- memcached_server_st *
- memcached_server_list_append (memcached_server_st *ptr,
+ void memcached_server_list_free (memcached_server_list_st list);
+
+ memcached_server_list_st
+ memcached_server_list_append (memcached_server_list_st list,
const char *hostname,
unsigned int port,
memcached_return_t *error);
- unsigned int memcached_server_list_count (memcached_server_st *ptr);
+ uint32_t memcached_server_list_count (memcached_server_list_st list);
- memcached_server_st *memcached_servers_parse (const char *server_strings);
+ memcached_server_list_st memcached_servers_parse (const char *server_strings);
- const char *memcached_server_error (memcached_server_st *ptr);
+ const char *memcached_server_error (memcached_server_instance_st instance);
- void memcached_server_error_reset (memcached_server_st *ptr);
+ DEPRECATED
+ void memcached_server_error_reset (memcached_server_instance_st list);
=head1 DESCRIPTION
@@ -34,6 +38,9 @@
directly. Functions are provided to modify these structures (and more can be
added, just ask!).
+memcached_server_list() is used to provide an array of all defined hosts.
+This was incorrectly documented as "requiring free()" up till version 0.39.
+
memcached_server_list_free() deallocates all memory associated with the array
of memcached_server_st that you passed to it.
@@ -49,9 +56,11 @@
be set to the default port, while that host will have a port of 555.
memcached_server_error() can be used to look at the text of the last error
-message sent by the server to to the client. Use memcached_server_error_reset()
-to reset the message (this does not currently free up the memory associated
-with the message).
+message sent by the server to to the client.
+
+Before version 0.39 theses functions used a memcache_server_st *. In 0.39
+memcached_server_st * was aliased to memcached_server_list_st. This was
+done for a style reason/to help clean up some concepts in the code.
=head1 RETURN
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/docs/memcached_servers.pod
^
|
@@ -12,9 +12,6 @@
uint32_t memcached_server_count (memcached_st *ptr);
- memcached_server_st *
- memcached_server_list (memcached_st *ptr);
-
memcached_return_t
memcached_server_add (memcached_st *ptr,
const char *hostname,
@@ -22,8 +19,8 @@
memcached_return_t
memcached_server_add_udp (memcached_st *ptr,
- const char *hostname,
- in_port_t port);
+ const char *hostname,
+ in_port_t port);
memcached_return_t
memcached_server_add_unix_socket (memcached_st *ptr,
@@ -31,21 +28,22 @@
memcached_return_t
memcached_server_push (memcached_st *ptr,
- memcached_server_st *list);
+ const memcached_server_st *list);
- memcached_server_st *
- memcached_server_by_key (memcached_st *ptr,
- const char *key, size_t key_length,
+ memcached_server_instance_st
+ memcached_server_by_key (const memcached_st *ptr,
+ const char *key,
+ size_t key_length,
memcached_return_t *error);
- memcached_server_st *
- memcached_server_get_last_disconnect (memcached_st *ptr)
+ memcached_server_instance_st
+ memcached_server_get_last_disconnect (const memcached_st *ptr)
memcached_return_t
- memcached_server_cursor(memcached_st *ptr,
- memcached_server_fn *callback,
- void *context,
- uint32_t number_of_callbacks);
+ memcached_server_cursor(const memcached_st *ptr,
+ const memcached_server_fn *callback,
+ void *context,
+ uint32_t number_of_callbacks);
=head1 DESCRIPTION
@@ -58,10 +56,6 @@
memcached_server_count() provides you a count of the current number of
servers being used by a C<memcached_st> structure.
-memcached_server_list() is used to provide an array of all defined hosts.
-You are responsible for freeing this list (aka it is not a pointer to the
-currently used structure).
-
memcached_server_add() pushes a single TCP server into the C<memcached_st>
structure. This server will be placed at the end. Duplicate servers are
allowed, so duplication is not checked. Executing this function with the
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/example/include.am
^
|
@@ -2,7 +2,9 @@
# included from Top Level Makefile.am
# All paths should be given relative to the root
+if HAVE_LIBEVENT
noinst_PROGRAMS += example/memcached_light
+endif
example_memcached_light_SOURCES= \
example/interface_v0.c \
@@ -11,7 +13,8 @@
example/memcached_light.h \
example/storage.h
-example_memcached_light_LDADD= libmemcached/libmemcachedprotocol.la $(LIBINNODB)
+example_memcached_light_LDADD= libmemcached/libmemcachedprotocol.la \
+ $(LIBINNODB) $(LTLIBEVENT)
if BUILD_BYTEORDER
example_memcached_light_LDADD+= libmemcached/libbyteorder.la
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/example/memcached_light.c
^
|
@@ -35,7 +35,7 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
-#include <poll.h>
+#include <event.h>
#include <libmemcached/protocol_handler.h>
#include <libmemcached/byteorder.h>
@@ -47,8 +47,19 @@
static int server_sockets[1024];
static int num_server_sockets= 0;
-static void* socket_userdata_map[1024];
+
+struct connection
+{
+ void *userdata;
+ struct event event;
+};
+
+/* The default maximum number of connections... (change with -c) */
+static int maxconns = 1024;
+
+static struct connection *socket_userdata_map;
static bool verbose= false;
+static struct event_base *event_base;
struct options_st {
char *pid_file;
@@ -59,6 +70,99 @@
typedef struct options_st options_st;
/**
+ * Callback for driving a client connection
+ * @param fd the socket for the client socket
+ * @param which identifying the event that occurred (not used)
+ * @param arg the connection structure for the client
+ */
+static void drive_client(int fd, short which, void *arg)
+{
+ (void)which;
+ struct connection *client= arg;
+ struct memcached_protocol_client_st* c= client->userdata;
+ assert(c != NULL);
+
+ memcached_protocol_event_t events= memcached_protocol_client_work(c);
+ if (events & MEMCACHED_PROTOCOL_ERROR_EVENT)
+ {
+ memcached_protocol_client_destroy(c);
+ (void)close(fd);
+ } else {
+ short flags = 0;
+ if (events & MEMCACHED_PROTOCOL_WRITE_EVENT)
+ {
+ flags= EV_WRITE;
+ }
+
+ if (events & MEMCACHED_PROTOCOL_READ_EVENT)
+ {
+ flags|= EV_READ;
+ }
+
+ event_set(&client->event, fd, flags, drive_client, client);
+ event_base_set(event_base, &client->event);
+
+ if (event_add(&client->event, 0) == -1)
+ {
+ (void)fprintf(stderr, "Failed to add event for %d\n", fd);
+ memcached_protocol_client_destroy(c);
+ (void)close(fd);
+ }
+ }
+}
+
+/**
+ * Callback for accepting new connections
+ * @param fd the socket for the server socket
+ * @param which identifying the event that occurred (not used)
+ * @param arg the connection structure for the server
+ */
+static void accept_handler(int fd, short which, void *arg)
+{
+ (void)which;
+ struct connection *server= arg;
+ /* accept new client */
+ struct sockaddr_storage addr;
+ socklen_t addrlen= sizeof(addr);
+ int sock= accept(fd, (struct sockaddr *)&addr, &addrlen);
+
+ if (sock == -1)
+ {
+ perror("Failed to accept client");
+ return ;
+ }
+
+ if (sock >= maxconns)
+ {
+ (void)fprintf(stderr, "Client outside socket range (specified with -c)\n");
+ (void)close(sock);
+ return ;
+ }
+
+ struct memcached_protocol_client_st* c;
+ c= memcached_protocol_create_client(server->userdata, sock);
+ if (c == NULL)
+ {
+ (void)fprintf(stderr, "Failed to create client\n");
+ (void)close(sock);
+ }
+ else
+ {
+ struct connection *client = &socket_userdata_map[sock];
+ client->userdata= c;
+
+ event_set(&client->event, sock, EV_READ, drive_client, client);
+ event_base_set(event_base, &client->event);
+ if (event_add(&client->event, 0) == -1)
+ {
+ (void)fprintf(stderr, "Failed to add event for %d\n", sock);
+ memcached_protocol_client_destroy(c);
+ (void)close(sock);
+ }
+ }
+}
+
+/**
* Create a socket and bind it to a specific port number
* @param port the port number to bind to
*/
@@ -224,8 +328,6 @@
return response_handler(cookie, header, (void*)&response);
}
-static void work(void);
-
/**
* Program entry point. Bind to the specified port(s) and serve clients
*
@@ -240,13 +342,20 @@
memset(&global_options, 0, sizeof(global_options));
+ event_base= event_init();
+ if (event_base == NULL)
+ {
+ fprintf(stderr, "Failed to create an instance of libevent\n");
+ return 1;
+ }
+
/*
* We need to initialize the handlers manually due to a bug in the
* warnings generated by struct initialization in gcc (all the way up to 4.4)
*/
initialize_interface_v0_handler();
- while ((cmd= getopt(argc, argv, "v1pP:?h")) != EOF)
+ while ((cmd= getopt(argc, argv, "v1p:P:?hc:")) != EOF)
{
switch (cmd) {
case '1':
@@ -262,10 +371,14 @@
case 'v':
verbose= true;
break;
+ case 'c':
+ maxconns= atoi(optarg);
+ break;
case 'h': /* FALLTHROUGH */
case '?': /* FALLTHROUGH */
default:
- (void)fprintf(stderr, "Usage: %s [-p port] [-v] [-1]\n", argv[0]);
+ (void)fprintf(stderr, "Usage: %s [-p port] [-v] [-1] [-c #clients] [-P pidfile]\n",
+ argv[0]);
return 1;
}
}
@@ -319,110 +432,33 @@
return 1;
}
+ socket_userdata_map= calloc((size_t)(maxconns), sizeof(struct connection));
+ if (socket_userdata_map == NULL)
+ {
+ fprintf(stderr, "Failed to allocate room for connections\n");
+ return 1;
+ }
+
memcached_binary_protocol_set_callbacks(protocol_handle, interface);
memcached_binary_protocol_set_pedantic(protocol_handle, true);
for (int xx= 0; xx < num_server_sockets; ++xx)
- socket_userdata_map[server_sockets[xx]]= protocol_handle;
+ {
+ struct connection *conn= &socket_userdata_map[server_sockets[xx]];
+ conn->userdata= protocol_handle;
+ event_set(&conn->event, server_sockets[xx], EV_READ | EV_PERSIST,
+ accept_handler, conn);
+ event_base_set(event_base, &conn->event);
+ if (event_add(&conn->event, 0) == -1)
+ {
+ fprintf(stderr, "Failed to add event for %d\n", server_sockets[xx]);
+ close(server_sockets[xx]);
+ }
+ }
/* Serve all of the clients */
- work();
+ event_base_loop(event_base, 0);
/* NOTREACHED */
return 0;
}
-
-static void work(void)
-{
-#define MAX_SERVERS_TO_POLL 100
- struct pollfd fds[MAX_SERVERS_TO_POLL];
- int max_poll;
-
- for (max_poll= 0; max_poll < num_server_sockets; ++max_poll)
- {
- fds[max_poll].events= POLLIN;
- fds[max_poll].revents= 0;
- fds[max_poll].fd= server_sockets[max_poll];
- }
-
- while (true)
- {
- int err= poll(fds, (nfds_t)max_poll, -1);
-
- if (err == 0 || (err == -1 && errno != EINTR))
- {
- perror("poll() failed");
- abort();
- }
-
- /* find the available filedescriptors */
- for (int x= max_poll - 1; x > -1 && err > 0; --x)
- {
- if (fds[x].revents != 0)
- {
- --err;
- if (x < num_server_sockets)
- {
- /* accept new client */
- struct sockaddr_storage addr;
- socklen_t addrlen= sizeof(addr);
- int sock= accept(fds[x].fd, (struct sockaddr *)&addr,
- &addrlen);
-
- if (sock == -1)
- {
- perror("Failed to accept client");
- continue;
- }
-
- struct memcached_protocol_st *protocol;
- protocol= socket_userdata_map[fds[x].fd];
-
- struct memcached_protocol_client_st* c;
- c= memcached_protocol_create_client(protocol, sock);
- if (c == NULL)
- {
- fprintf(stderr, "Failed to create client\n");
- close(sock);
- }
- else
- {
- socket_userdata_map[sock]= c;
- fds[max_poll].events= POLLIN;
- fds[max_poll].revents= 0;
- fds[max_poll].fd= sock;
- ++max_poll;
- }
- }
- else
- {
- /* drive the client */
- struct memcached_protocol_client_st* c;
- c= socket_userdata_map[fds[x].fd];
- assert(c != NULL);
- fds[max_poll].events= 0;
-
- memcached_protocol_event_t events= memcached_protocol_client_work(c);
- if (events & MEMCACHED_PROTOCOL_WRITE_EVENT)
- fds[max_poll].events= POLLOUT;
-
- if (events & MEMCACHED_PROTOCOL_READ_EVENT)
- fds[max_poll].events= POLLIN;
-
- if (!(events & MEMCACHED_PROTOCOL_PAUSE_EVENT ||
- fds[max_poll].events != 0))
- {
- memcached_protocol_client_destroy(c);
- close(fds[x].fd);
- fds[x].events= 0;
-
- if (x != max_poll - 1)
- memmove(fds + x, fds + x + 1, (size_t)(max_poll - x));
-
- --max_poll;
- }
- }
- }
- }
- }
-}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/example/storage_innodb.c
^
|
@@ -129,8 +129,9 @@
if (tuple != NULL)
ib_tuple_delete(tuple);
+ ib_err_t currsor_error;
if (cursor != NULL)
- ib_cursor_close(cursor);
+ currsor_error= ib_cursor_close(cursor);
return retval;
}
@@ -182,8 +183,11 @@
error_exit:
if (tuple != NULL)
ib_tuple_delete(tuple);
+
+ ib_err_t cursor_error;
if (*cursor != NULL)
- ib_cursor_close(*cursor);
+ cursor_error= ib_cursor_close(*cursor);
+
*cursor= NULL;
return false;
@@ -253,8 +257,9 @@
if (tuple != NULL)
ib_tuple_delete(tuple);
+ ib_err_t cursor_error;
if (cursor != NULL)
- ib_cursor_close(cursor);
+ cursor_error= ib_cursor_close(cursor);
return retval;
}
@@ -282,7 +287,10 @@
error_exit:
if (cursor != NULL)
- ib_cursor_close(cursor);
+ {
+ ib_err_t cursor_error;
+ cursor_error= ib_cursor_close(cursor);
+ }
return retval;
}
@@ -325,6 +333,7 @@
return true;
error_exit:
+
return false;
}
@@ -333,7 +342,7 @@
*/
void shutdown_storage(void)
{
- checked(ib_shutdown());
+ checked(ib_shutdown(IB_SHUTDOWN_NORMAL));
error_exit:
;
}
@@ -487,14 +496,17 @@
fprintf(stderr, "Failed to flush the cache: %s\n", ib_strerror(err));
goto error_exit;
}
- ib_cursor_close(cursor);
+ ib_err_t cursor_error;
+ cursor_error= ib_cursor_close(cursor);
cursor= NULL;
checked(ib_trx_commit(transaction));
return;
error_exit:
if (cursor != NULL)
- ib_cursor_close(cursor);
+ {
+ cursor_error= ib_cursor_close(cursor);
+ }
ib_err_t error= ib_trx_rollback(transaction);
if (error != DB_SUCCESS)
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libhashkit/configure.h
^
|
@@ -12,8 +12,6 @@
extern "C" {
#endif
-#define HASHKIT_BITFIELD :1
-
#ifdef __cplusplus
}
#endif
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libhashkit/configure.h.in
^
|
@@ -12,8 +12,6 @@
extern "C" {
#endif
-@HASHKIT_BITFIELD@
-
#ifdef __cplusplus
}
#endif
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libhashkit/hashkit.h
^
|
@@ -58,11 +58,11 @@
} base_hash, distribution_hash;
struct {
- bool is_base_same_distributed HASHKIT_BITFIELD;
+ bool is_base_same_distributed:1;
} flags;
struct {
- bool is_allocated HASHKIT_BITFIELD;
+ bool is_allocated:1;
} options;
};
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/auto.c
^
|
@@ -22,7 +22,7 @@
memcached_return_t rc;
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
uint32_t server_key;
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
bool no_reply= ptr->flags.no_reply;
unlikely (memcached_server_count(ptr) == 0)
@@ -31,7 +31,7 @@
if (ptr->flags.verify_key && (memcached_key_test((const char **)&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED))
return MEMCACHED_BAD_KEY_PROVIDED;
- server_key= memcached_generate_hash(ptr, master_key, master_key_length);
+ server_key= memcached_generate_hash_with_redistribution(ptr, master_key, master_key_length);
instance= memcached_server_instance_fetch(ptr, server_key);
send_length= (size_t)snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
@@ -56,7 +56,12 @@
use it. We still called memcached_response() though since it
worked its magic for non-blocking IO.
*/
- if (!strncmp(buffer, "ERROR\r\n", 7))
+ if (! strncmp(buffer, "ERROR\r\n", 7))
+ {
+ *value= 0;
+ rc= MEMCACHED_PROTOCOL_ERROR;
+ }
+ else if (! strncmp(buffer, "CLIENT_ERROR\r\n", 14))
{
*value= 0;
rc= MEMCACHED_PROTOCOL_ERROR;
@@ -83,13 +88,13 @@
uint64_t *value)
{
uint32_t server_key;
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
bool no_reply= ptr->flags.no_reply;
unlikely (memcached_server_count(ptr) == 0)
return MEMCACHED_NO_SERVERS;
- server_key= memcached_generate_hash(ptr, master_key, master_key_length);
+ server_key= memcached_generate_hash_with_redistribution(ptr, master_key, master_key_length);
instance= memcached_server_instance_fetch(ptr, server_key);
if (no_reply)
@@ -103,20 +108,26 @@
request.message.header.request.magic= PROTOCOL_BINARY_REQ;
request.message.header.request.opcode= cmd;
- request.message.header.request.keylen= htons((uint16_t) key_length);
+ request.message.header.request.keylen= htons((uint16_t)(key_length + ptr->prefix_key_length));
request.message.header.request.extlen= 20;
request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
- request.message.header.request.bodylen= htonl((uint32_t) (key_length + request.message.header.request.extlen));
+ request.message.header.request.bodylen= htonl((uint32_t)(key_length + ptr->prefix_key_length + request.message.header.request.extlen));
request.message.body.delta= htonll(offset);
request.message.body.initial= htonll(initial);
request.message.body.expiration= htonl((uint32_t) expiration);
- if ((memcached_do(instance, request.bytes,
- sizeof(request.bytes), false) != MEMCACHED_SUCCESS) ||
- (memcached_io_write(instance, key, key_length, true) == -1))
+ struct __write_vector_st vector[]=
+ {
+ { .length= sizeof(request.bytes), .buffer= request.bytes },
+ { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
+ { .length= key_length, .buffer= key }
+ };
+
+ memcached_return_t rc;
+ if ((rc= memcached_vdo(instance, vector, 3, true)) != MEMCACHED_SUCCESS)
{
memcached_io_reset(instance);
- return MEMCACHED_WRITE_FAILURE;
+ return (rc == MEMCACHED_SUCCESS) ? MEMCACHED_WRITE_FAILURE : rc;
}
if (no_reply)
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/behavior.c
^
|
@@ -87,6 +87,10 @@
ptr->flags.tcp_nodelay= set_flag(data);
memcached_quit(ptr);
break;
+ case MEMCACHED_BEHAVIOR_TCP_KEEPALIVE:
+ ptr->flags.tcp_keepalive= set_flag(data);
+ memcached_quit(ptr);
+ break;
case MEMCACHED_BEHAVIOR_DISTRIBUTION:
return memcached_behavior_set_distribution(ptr, (memcached_server_distribution_t)data);
case MEMCACHED_BEHAVIOR_KETAMA:
@@ -114,7 +118,7 @@
/**
@note We try to keep the same distribution going. This should be deprecated and rewritten.
*/
- return memcached_behavior_set_distribution(ptr, MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA);
+ return memcached_behavior_set_distribution(ptr, MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA);
}
case MEMCACHED_BEHAVIOR_HASH:
return memcached_behavior_set_key_hash(ptr, (memcached_hash_t)(data));
@@ -153,6 +157,10 @@
ptr->recv_size= (int32_t)data;
memcached_quit(ptr);
break;
+ case MEMCACHED_BEHAVIOR_TCP_KEEPIDLE:
+ ptr->tcp_keepidle= (uint32_t)data;
+ memcached_quit(ptr);
+ break;
case MEMCACHED_BEHAVIOR_USER_DATA:
return MEMCACHED_FAILURE;
case MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY:
@@ -170,7 +178,7 @@
break;
case MEMCACHED_BEHAVIOR_CORK:
{
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
bool action= set_flag(data);
if (action == false)
@@ -230,6 +238,11 @@
return MEMCACHED_SUCCESS;
}
+bool _is_auto_eject_host(const memcached_st *ptr)
+{
+ return ptr->flags.auto_eject_hosts;
+}
+
uint64_t memcached_behavior_get(memcached_st *ptr,
const memcached_behavior_t flag)
{
@@ -283,11 +296,13 @@
return (uint64_t)ptr->snd_timeout;
case MEMCACHED_BEHAVIOR_RCV_TIMEOUT:
return (uint64_t)ptr->rcv_timeout;
+ case MEMCACHED_BEHAVIOR_TCP_KEEPIDLE:
+ return (uint64_t)ptr->tcp_keepidle;
case MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE:
{
int sock_size= 0;
socklen_t sock_length= sizeof(int);
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
if (ptr->send_size != -1) // If value is -1 then we are using the default
return (uint64_t) ptr->send_size;
@@ -312,15 +327,15 @@
{
int sock_size= 0;
socklen_t sock_length= sizeof(int);
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
if (ptr->recv_size != -1) // If value is -1 then we are using the default
return (uint64_t) ptr->recv_size;
instance= memcached_server_instance_fetch(ptr, 0);
- /**
- @note REFACTOR
+ /**
+ @note REFACTOR
*/
if (instance)
{
@@ -348,6 +363,8 @@
return ptr->flags.randomize_replica_read;
case MEMCACHED_BEHAVIOR_CORK:
return ptr->flags.cork;
+ case MEMCACHED_BEHAVIOR_TCP_KEEPALIVE:
+ return ptr->flags.tcp_keepalive;
case MEMCACHED_BEHAVIOR_MAX:
default:
WATCHPOINT_ASSERT(0); /* Programming mistake if it gets this far */
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/behavior.h
^
|
@@ -40,6 +40,9 @@
LIBMEMCACHED_API
memcached_hash_t memcached_behavior_get_distribution_hash(memcached_st *ptr);
+LIBMEMCACHED_LOCAL
+bool _is_auto_eject_host(const memcached_st *ptr);
+
#ifdef __cplusplus
}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/common.h
^
|
@@ -54,11 +54,14 @@
#include "libmemcached/memcached.h"
#include "libmemcached/watchpoint.h"
-typedef struct memcached_server_st memcached_server_instance_st;
+typedef struct memcached_server_st * memcached_server_write_instance_st;
+
+LIBMEMCACHED_LOCAL
+memcached_server_write_instance_st memcached_server_instance_fetch(memcached_st *ptr, uint32_t server_key);
/* These are private not to be installed headers */
-#include "libmemcached/do.h"
#include "libmemcached/io.h"
+#include "libmemcached/do.h"
#include "libmemcached/internal.h"
#include "libmemcached/libmemcached_probes.h"
#include "libmemcached/memcached/protocol_binary.h"
@@ -101,10 +104,7 @@
#endif
LIBMEMCACHED_LOCAL
-memcached_return_t memcached_connect(memcached_server_instance_st *ptr);
-
-LIBMEMCACHED_LOCAL
-void memcached_quit_server(memcached_server_instance_st *ptr, bool io_death);
+memcached_return_t memcached_connect(memcached_server_write_instance_st ptr);
LIBMEMCACHED_LOCAL
memcached_return_t run_distribution(memcached_st *ptr);
@@ -123,13 +123,8 @@
#define memcached_set_initialized(__object, __value) ((__object)->options.is_initialized(= (__value))
#define memcached_set_allocated(__object, __value) ((__object)->options.is_allocated(= (__value))
-
LIBMEMCACHED_LOCAL
-memcached_return_t value_fetch(memcached_server_instance_st *ptr,
- char *buffer,
- memcached_result_st *result);
-LIBMEMCACHED_LOCAL
-void server_list_free(memcached_st *ptr, memcached_server_instance_st *servers);
+void set_last_disconnected_host(memcached_server_write_instance_st ptr);
LIBMEMCACHED_LOCAL
memcached_return_t memcached_key_test(const char * const *keys,
@@ -137,10 +132,16 @@
size_t number_of_keys);
LIBMEMCACHED_LOCAL
-uint32_t generate_hash(memcached_st *ptr, const char *key, size_t key_length);
+memcached_return_t memcached_purge(memcached_server_write_instance_st ptr);
LIBMEMCACHED_LOCAL
-memcached_return_t memcached_purge(memcached_server_instance_st *ptr);
+memcached_server_st *memcached_server_create_with(const memcached_st *memc,
+ memcached_server_write_instance_st host,
+ const char *hostname,
+ in_port_t port,
+ uint32_t weight,
+ memcached_connection_t type);
+
static inline memcached_return_t memcached_validate_key_length(size_t key_length, bool binary)
{
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/configure.h
^
|
@@ -16,11 +16,11 @@
extern "C" {
#endif
-#define MEMCACHED_BITFIELD :1
-#define LIBMEMCACHED_VERSION_STRING "0.38"
-#define LIBMEMCACHED_VERSION_HEX 0x00038000
+
+#define LIBMEMCACHED_VERSION_STRING "0.40"
+#define LIBMEMCACHED_VERSION_HEX 0x00040000
#ifdef __cplusplus
}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/configure.h.in
^
|
@@ -16,8 +16,8 @@
extern "C" {
#endif
-@MEMCACHED_BITFIELD@
@DEPRECATED@
+@LIBMEMCACHED_WITH_SASL_SUPPORT@
#define LIBMEMCACHED_VERSION_STRING "@VERSION@"
#define LIBMEMCACHED_VERSION_HEX @PANDORA_HEX_VERSION@
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/connect.c
^
|
@@ -2,13 +2,14 @@
#include <netdb.h>
#include <poll.h>
#include <sys/time.h>
+#include <time.h>
static memcached_return_t set_hostinfo(memcached_server_st *server)
{
struct addrinfo *ai;
struct addrinfo hints;
- int e;
char str_port[NI_MAXSERV];
+ uint32_t counter= 5;
snprintf(str_port, NI_MAXSERV, "%u", (uint32_t)server->port);
@@ -26,12 +27,31 @@
hints.ai_protocol= IPPROTO_TCP;
}
- e= getaddrinfo(server->hostname, str_port, &hints, &ai);
- if (e != 0)
+ while (--counter)
{
- WATCHPOINT_STRING(server->hostname);
- WATCHPOINT_STRING(gai_strerror(e));
- return MEMCACHED_HOST_LOOKUP_FAILURE;
+ int e= getaddrinfo(server->hostname, str_port, &hints, &ai);
+
+ if (e == 0)
+ {
+ break;
+ }
+ else if (e == EAI_AGAIN)
+ {
+ struct timespec dream, rem;
+
+ dream.tv_nsec= 1000;
+ dream.tv_sec= 0;
+
+ nanosleep(&dream, &rem);
+
+ continue;
+ }
+ else
+ {
+ WATCHPOINT_STRING(server->hostname);
+ WATCHPOINT_STRING(gai_strerror(e));
+ return MEMCACHED_HOST_LOOKUP_FAILURE;
+ }
}
if (server->address_info)
@@ -85,6 +105,21 @@
}
#endif
+
+#if defined(__MACH__) && defined(__APPLE__) || defined(__FreeBSD__)
+ {
+ int set = 1;
+ int error= setsockopt(ptr->fd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&set, sizeof(int));
+
+ // This is not considered a fatal error
+ if (error == -1)
+ {
+ WATCHPOINT_ERRNO(errno);
+ perror("setsockopt(SO_NOSIGPIPE)");
+ }
+ }
+#endif
+
if (ptr->root->flags.no_block)
{
int error;
@@ -111,6 +146,31 @@
return MEMCACHED_FAILURE;
}
+ if (ptr->root->flags.tcp_keepalive)
+ {
+ int flag= 1;
+ int error;
+
+ error= setsockopt(ptr->fd, SOL_SOCKET, SO_KEEPALIVE,
+ &flag, (socklen_t)sizeof(int));
+ WATCHPOINT_ASSERT(error == 0);
+ if (error)
+ return MEMCACHED_FAILURE;
+ }
+
+#ifdef TCP_KEEPIDLE
+ if (ptr->root->tcp_keepidle > 0)
+ {
+ int error;
+
+ error= setsockopt(ptr->fd, IPPROTO_TCP, TCP_KEEPIDLE,
+ &ptr->root->tcp_keepidle, (socklen_t)sizeof(int));
+ WATCHPOINT_ASSERT(error == 0);
+ if (error)
+ return MEMCACHED_FAILURE;
+ }
+#endif
+
if (ptr->root->send_size > 0)
{
int error;
@@ -199,6 +259,7 @@
}
WATCHPOINT_ASSERT(ptr->fd != -1);
+
return MEMCACHED_SUCCESS;
}
@@ -244,8 +305,7 @@
(void)set_socket_options(ptr);
/* connect to server */
- while (ptr->fd != -1 &&
- connect(ptr->fd, use->ai_addr, use->ai_addrlen) < 0)
+ if ((connect(ptr->fd, use->ai_addr, use->ai_addrlen) == -1))
{
ptr->cached_errno= errno;
if (errno == EINPROGRESS || /* nonblocking mode - first return, */
@@ -254,20 +314,48 @@
struct pollfd fds[1];
fds[0].fd = ptr->fd;
fds[0].events = POLLOUT;
- int error= poll(fds, 1, ptr->root->connect_timeout);
- if (error != 1 || fds[0].revents & POLLERR)
+ int timeout= ptr->root->connect_timeout;
+ if (ptr->root->flags.no_block == false)
+ timeout= -1;
+
+ size_t loop_max= 5;
+ while (--loop_max)
{
- if (fds[0].revents & POLLERR)
+ int error= poll(fds, 1, timeout);
+
+ switch (error)
{
- int err;
- socklen_t len = sizeof (err);
- (void)getsockopt(ptr->fd, SOL_SOCKET, SO_ERROR, &err, &len);
- ptr->cached_errno= (err == 0) ? errno : err;
- }
+ case 1:
+ loop_max= 1;
+ break;
+ case 0:
+ continue;
+ // A real error occurred and we need to completely bail
+ default:
+ WATCHPOINT_ERRNO(errno);
+ switch (errno)
+ {
+#ifdef TARGET_OS_LINUX
+ case ERESTART:
+#endif
+ case EINTR:
+ continue;
+ default:
+ if (fds[0].revents & POLLERR)
+ {
+ int err;
+ socklen_t len= sizeof (err);
+ (void)getsockopt(ptr->fd, SOL_SOCKET, SO_ERROR, &err, &len);
+ ptr->cached_errno= (err == 0) ? errno : err;
+ }
+
+ (void)close(ptr->fd);
+ ptr->fd= -1;
- (void)close(ptr->fd);
- ptr->fd= -1;
+ break;
+ }
+ }
}
}
else if (errno == EISCONN) /* we are connected :-) */
@@ -282,9 +370,23 @@
}
}
+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+ if (ptr->fd != -1 && ptr->root->sasl.callbacks != NULL)
+ {
+ memcached_return rc= memcached_sasl_authenticate_connection(ptr);
+ if (rc != MEMCACHED_SUCCESS)
+ {
+ (void)close(ptr->fd);
+ ptr->fd= -1;
+
+ return rc;
+ }
+ }
+#endif
+
+
if (ptr->fd != -1)
{
- ptr->server_failure_counter= 0;
return MEMCACHED_SUCCESS;
}
use = use->ai_next;
@@ -293,6 +395,8 @@
if (ptr->fd == -1)
{
+ WATCHPOINT_STRING("Never got a good file descriptor");
+
/* Failed to connect. schedule next retry */
if (ptr->root->retry_timeout)
{
@@ -301,52 +405,68 @@
if (gettimeofday(&next_time, NULL) == 0)
ptr->next_retry= next_time.tv_sec + ptr->root->retry_timeout;
}
- ptr->server_failure_counter++;
+
if (ptr->cached_errno == 0)
return MEMCACHED_TIMEOUT;
return MEMCACHED_ERRNO; /* The last error should be from connect() */
}
- ptr->server_failure_counter= 0;
return MEMCACHED_SUCCESS; /* The last error should be from connect() */
}
+void set_last_disconnected_host(memcached_server_write_instance_st ptr)
+{
+ // const_cast
+ memcached_st *root= (memcached_st *)ptr->root;
-memcached_return_t memcached_connect(memcached_server_st *ptr)
+#if 0
+ WATCHPOINT_STRING(ptr->hostname);
+ WATCHPOINT_NUMBER(ptr->port);
+ WATCHPOINT_ERRNO(ptr->cached_errno);
+#endif
+ if (root->last_disconnected_server)
+ memcached_server_free(root->last_disconnected_server);
+ root->last_disconnected_server= memcached_server_clone(NULL, ptr);
+}
+
+memcached_return_t memcached_connect(memcached_server_write_instance_st ptr)
{
memcached_return_t rc= MEMCACHED_NO_SERVERS;
LIBMEMCACHED_MEMCACHED_CONNECT_START();
/* both retry_timeout and server_failure_limit must be set in order to delay retrying a server on error. */
WATCHPOINT_ASSERT(ptr->root);
- if (ptr->root->retry_timeout && ptr->root->server_failure_limit)
+ if (ptr->root->retry_timeout && ptr->next_retry)
{
struct timeval curr_time;
gettimeofday(&curr_time, NULL);
- /* if we've had too many consecutive errors on this server, mark it dead. */
- if (ptr->server_failure_counter >= ptr->root->server_failure_limit)
+ // We should optimize this to remove the allocation if the server was
+ // the last server to die
+ if (ptr->next_retry > curr_time.tv_sec)
{
- ptr->next_retry= curr_time.tv_sec + ptr->root->retry_timeout;
- ptr->server_failure_counter= 0;
+ set_last_disconnected_host(ptr);
+
+ return MEMCACHED_SERVER_MARKED_DEAD;
}
+ }
- if (curr_time.tv_sec < ptr->next_retry)
+ // If we are over the counter failure, we just fail. Reject host only
+ // works if you have a set number of failures.
+ if (ptr->root->server_failure_limit && ptr->server_failure_counter >= ptr->root->server_failure_limit)
+ {
+ set_last_disconnected_host(ptr);
+
+ // @todo fix this by fixing behavior to no longer make use of
+ // memcached_st
+ if (_is_auto_eject_host(ptr->root))
{
- memcached_st *root= (memcached_st *)ptr->root;
- // @todo fix this by fixing behavior to no longer make use of
- // memcached_st
- if (memcached_behavior_get(root, MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS))
- {
- run_distribution(root);
- }
-
- root->last_disconnected_server = ptr;
-
- return MEMCACHED_SERVER_MARKED_DEAD;
+ run_distribution((memcached_st *)ptr->root);
}
+
+ return MEMCACHED_SERVER_MARKED_DEAD;
}
/* We need to clean up the multi startup piece */
@@ -368,11 +488,16 @@
WATCHPOINT_ASSERT(0);
}
- unlikely ( rc != MEMCACHED_SUCCESS)
+ if (rc == MEMCACHED_SUCCESS)
{
- //@todo create interface around last_discontected_server
- memcached_st *root= (memcached_st *)ptr->root;
- root->last_disconnected_server = ptr;
+ ptr->server_failure_counter= 0;
+ ptr->next_retry= 0;
+ }
+ else
+ {
+ ptr->server_failure_counter++;
+
+ set_last_disconnected_host(ptr);
}
LIBMEMCACHED_MEMCACHED_CONNECT_END();
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/constants.h
^
|
@@ -21,7 +21,8 @@
#define MEMCACHED_POINTS_PER_SERVER_KETAMA 160
#define MEMCACHED_CONTINUUM_SIZE MEMCACHED_POINTS_PER_SERVER*100 /* This would then set max hosts to 100 */
#define MEMCACHED_STRIDE 4
-#define MEMCACHED_DEFAULT_TIMEOUT 1000
+#define MEMCACHED_DEFAULT_TIMEOUT 5000
+#define MEMCACHED_DEFAULT_CONNECT_TIMEOUT 4000
#define MEMCACHED_CONTINUUM_ADDITION 10 /* How many extra slots we should build for in the continuum */
#define MEMCACHED_PREFIX_KEY_MAX_SIZE 128
#define MEMCACHED_EXPIRATION_NOT_ADD 0xffffffffU
@@ -69,6 +70,9 @@
MEMCACHED_E2BIG,
MEMCACHED_INVALID_ARGUMENTS,
MEMCACHED_KEY_TOO_BIG,
+ MEMCACHED_AUTH_PROBLEM,
+ MEMCACHED_AUTH_FAILURE,
+ MEMCACHED_AUTH_CONTINUE,
MEMCACHED_MAXIMUM_RETURN /* Always add new error code before */
} memcached_return_t;
@@ -115,6 +119,8 @@
MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS,
MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ,
MEMCACHED_BEHAVIOR_CORK,
+ MEMCACHED_BEHAVIOR_TCP_KEEPALIVE,
+ MEMCACHED_BEHAVIOR_TCP_KEEPIDLE,
MEMCACHED_BEHAVIOR_MAX
} memcached_behavior_t;
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/delete.c
^
|
@@ -24,7 +24,7 @@
memcached_return_t rc;
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
uint32_t server_key;
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
LIBMEMCACHED_MEMCACHED_DELETE_START();
@@ -36,7 +36,7 @@
unlikely (memcached_server_count(ptr) == 0)
return MEMCACHED_NO_SERVERS;
- server_key= memcached_generate_hash(ptr, master_key, master_key_length);
+ server_key= memcached_generate_hash_with_redistribution(ptr, master_key, master_key_length);
instance= memcached_server_instance_fetch(ptr, server_key);
to_write= (ptr->flags.buffer_requests) ? false : true;
@@ -99,11 +99,13 @@
}
}
else
- send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
- "delete %.*s%.*s%s\r\n",
- (int)ptr->prefix_key_length,
- ptr->prefix_key,
- (int)key_length, key, no_reply ? " noreply" :"");
+ {
+ send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
+ "delete %.*s%.*s%s\r\n",
+ (int)ptr->prefix_key_length,
+ ptr->prefix_key,
+ (int)key_length, key, no_reply ? " noreply" :"");
+ }
if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
{
@@ -126,7 +128,9 @@
goto error;
if (! to_write)
+ {
rc= MEMCACHED_BUFFERED;
+ }
else if (!no_reply)
{
rc= memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
@@ -148,7 +152,7 @@
size_t key_length,
bool flush)
{
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
protocol_binary_request_delete request= {.bytes= {0}};
instance= memcached_server_instance_fetch(ptr, server_key);
@@ -158,9 +162,9 @@
request.message.header.request.opcode= PROTOCOL_BINARY_CMD_DELETEQ;
else
request.message.header.request.opcode= PROTOCOL_BINARY_CMD_DELETE;
- request.message.header.request.keylen= htons((uint16_t)key_length);
+ request.message.header.request.keylen= htons((uint16_t)(key_length + ptr->prefix_key_length));
request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
- request.message.header.request.bodylen= htonl((uint32_t) key_length);
+ request.message.header.request.bodylen= htonl((uint32_t)(key_length + ptr->prefix_key_length));
if (ptr->flags.use_udp && ! flush)
{
@@ -171,15 +175,19 @@
memcached_io_write(instance, NULL, 0, true);
}
+ struct __write_vector_st vector[]=
+ {
+ { .length= sizeof(request.bytes), .buffer= request.bytes},
+ { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
+ { .length= key_length, .buffer= key },
+ };
+
memcached_return_t rc= MEMCACHED_SUCCESS;
- if ((memcached_do(instance, request.bytes,
- sizeof(request.bytes), false) != MEMCACHED_SUCCESS) ||
- (memcached_io_write(instance, key,
- key_length, flush) == -1))
+ if ((rc= memcached_vdo(instance, vector, 3, flush)) != MEMCACHED_SUCCESS)
{
memcached_io_reset(instance);
- rc= MEMCACHED_WRITE_FAILURE;
+ rc= (rc == MEMCACHED_SUCCESS) ? MEMCACHED_WRITE_FAILURE : rc;
}
unlikely (ptr->number_of_replicas > 0)
@@ -188,7 +196,7 @@
for (uint32_t x= 0; x < ptr->number_of_replicas; ++x)
{
- memcached_server_instance_st *replica;
+ memcached_server_write_instance_st replica;
++server_key;
if (server_key == memcached_server_count(ptr))
@@ -196,9 +204,7 @@
replica= memcached_server_instance_fetch(ptr, server_key);
- if ((memcached_do(replica, (const char*)request.bytes,
- sizeof(request.bytes), false) != MEMCACHED_SUCCESS) ||
- (memcached_io_write(replica, key, key_length, flush) == -1))
+ if (memcached_vdo(replica, vector, 3, flush) != MEMCACHED_SUCCESS)
{
memcached_io_reset(replica);
}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/do.c
^
|
@@ -11,7 +11,7 @@
#include "common.h"
-memcached_return_t memcached_do(memcached_server_st *ptr, const void *command,
+memcached_return_t memcached_do(memcached_server_write_instance_st ptr, const void *command,
size_t command_length, bool with_flush)
{
memcached_return_t rc;
@@ -32,14 +32,68 @@
** otherwise we might get a partial write.
**/
if (ptr->type == MEMCACHED_CONNECTION_UDP && with_flush && ptr->write_buffer_offset > UDP_DATAGRAM_HEADER_LENGTH)
+ {
memcached_io_write(ptr, NULL, 0, true);
+ }
sent_length= memcached_io_write(ptr, command, command_length, with_flush);
if (sent_length == -1 || (size_t)sent_length != command_length)
+ {
+ rc= MEMCACHED_WRITE_FAILURE;
+ }
+ else if ((ptr->root->flags.no_reply) == 0)
+ {
+ memcached_server_response_increment(ptr);
+ }
+
+ return rc;
+}
+
+memcached_return_t memcached_vdo(memcached_server_write_instance_st ptr,
+ const struct __write_vector_st *vector, size_t count,
+ bool with_flush)
+{
+ memcached_return_t rc;
+ ssize_t sent_length;
+
+ WATCHPOINT_ASSERT(count);
+ WATCHPOINT_ASSERT(vector);
+
+ if ((rc= memcached_connect(ptr)) != MEMCACHED_SUCCESS)
+ {
+ WATCHPOINT_ERROR(rc);
+ return rc;
+ }
+
+ /*
+ ** Since non buffering ops in UDP mode dont check to make sure they will fit
+ ** before they start writing, if there is any data in buffer, clear it out,
+ ** otherwise we might get a partial write.
+ **/
+ if (ptr->type == MEMCACHED_CONNECTION_UDP && with_flush && ptr->write_buffer_offset > UDP_DATAGRAM_HEADER_LENGTH)
+ {
+ memcached_io_write(ptr, NULL, 0, true);
+ }
+
+ sent_length= memcached_io_writev(ptr, vector, count, with_flush);
+
+ size_t command_length= 0;
+ for (uint32_t x= 0; x < count; ++x, vector++)
+ {
+ command_length+= vector->length;
+ }
+
+ if (sent_length == -1 || (size_t)sent_length != command_length)
+ {
rc= MEMCACHED_WRITE_FAILURE;
+ WATCHPOINT_ERROR(rc);
+ WATCHPOINT_ERRNO(errno);
+ }
else if ((ptr->root->flags.no_reply) == 0)
+ {
memcached_server_response_increment(ptr);
+ }
return rc;
}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/do.h
^
|
@@ -17,8 +17,15 @@
#endif
LIBMEMCACHED_LOCAL
-memcached_return_t memcached_do(memcached_server_instance_st *ptr, const void *commmand,
- size_t command_length, bool with_flush);
+memcached_return_t memcached_do(memcached_server_write_instance_st ptr,
+ const void *commmand,
+ size_t command_length,
+ bool with_flush);
+
+LIBMEMCACHED_LOCAL
+memcached_return_t memcached_vdo(memcached_server_write_instance_st ptr,
+ const struct __write_vector_st *vector, size_t count,
+ bool with_flush);
#ifdef __cplusplus
}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/dump.c
^
|
@@ -20,7 +20,7 @@
for (server_key= 0; server_key < memcached_server_count(ptr); server_key++)
{
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
instance= memcached_server_instance_fetch(ptr, server_key);
/* 256 I BELIEVE is the upper limit of slabs */
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/fetch.c
^
|
@@ -37,10 +37,7 @@
*key_length= result_buffer->key_length;
}
- if (result_buffer->item_flags)
- *flags= result_buffer->item_flags;
- else
- *flags= 0;
+ *flags= result_buffer->item_flags;
return memcached_string_c_copy(&result_buffer->value);
}
@@ -61,7 +58,7 @@
if ((result= memcached_result_create(ptr, NULL)) == NULL)
return NULL;
- while ((server = memcached_io_get_readable_server(ptr)) != NULL)
+ while ((server= memcached_io_get_readable_server(ptr)) != NULL)
{
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
*error= memcached_response(server, buffer, sizeof(buffer), result);
@@ -94,13 +91,12 @@
{
memcached_result_st *result= &ptr->result;
memcached_return_t rc= MEMCACHED_FAILURE;
- unsigned int x;
while ((result= memcached_fetch_result(ptr, result, &rc)) != NULL)
{
if (rc == MEMCACHED_SUCCESS)
{
- for (x= 0; x < number_of_callbacks; x++)
+ for (uint32_t x= 0; x < number_of_callbacks; x++)
{
rc= (*callback[x])(ptr, result, context);
if (rc != MEMCACHED_SUCCESS)
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/flush.c
^
|
@@ -32,7 +32,7 @@
for (x= 0; x < memcached_server_count(ptr); x++)
{
bool no_reply= ptr->flags.no_reply;
- memcached_server_instance_st *instance=
+ memcached_server_write_instance_st instance=
memcached_server_instance_fetch(ptr, x);
if (expiration)
@@ -55,7 +55,6 @@
static memcached_return_t memcached_flush_binary(memcached_st *ptr,
time_t expiration)
{
- uint32_t x;
protocol_binary_request_flush request= {.bytes= {0}};
unlikely (memcached_server_count(ptr) == 0)
@@ -68,9 +67,9 @@
request.message.header.request.bodylen= htonl(request.message.header.request.extlen);
request.message.body.expiration= htonl((uint32_t) expiration);
- for (x= 0; x < memcached_server_count(ptr); x++)
+ for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
- memcached_server_instance_st *instance=
+ memcached_server_write_instance_st instance=
memcached_server_instance_fetch(ptr, x);
if (ptr->flags.no_reply)
@@ -82,17 +81,16 @@
request.message.header.request.opcode= PROTOCOL_BINARY_CMD_FLUSH;
}
- if (memcached_do(instance, request.bytes,
- sizeof(request.bytes), true) != MEMCACHED_SUCCESS)
+ if (memcached_do(instance, request.bytes, sizeof(request.bytes), true) != MEMCACHED_SUCCESS)
{
memcached_io_reset(instance);
return MEMCACHED_WRITE_FAILURE;
}
}
- for (x= 0; x < memcached_server_count(ptr); x++)
+ for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
- memcached_server_instance_st *instance=
+ memcached_server_write_instance_st instance=
memcached_server_instance_fetch(ptr, x);
if (memcached_server_response_count(instance) > 0)
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/flush_buffers.c
^
|
@@ -6,7 +6,7 @@
for (uint32_t x= 0; x < memcached_server_count(memc); ++x)
{
- memcached_server_instance_st *instance=
+ memcached_server_write_instance_st instance=
memcached_server_instance_fetch(memc, x);
if (instance->write_buffer_offset != 0)
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/get.c
^
|
@@ -144,7 +144,6 @@
size_t number_of_keys,
bool mget_mode)
{
- uint32_t x;
memcached_return_t rc= MEMCACHED_NOTFOUND;
const char *get_command= "get ";
uint8_t get_command_length= 4;
@@ -169,7 +168,7 @@
{
if (ptr->flags.verify_key && (memcached_key_test((const char * const *)&master_key, &master_key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED))
return MEMCACHED_BAD_KEY_PROVIDED;
- master_server_key= memcached_generate_hash(ptr, master_key, master_key_length);
+ master_server_key= memcached_generate_hash_with_redistribution(ptr, master_key, master_key_length);
is_master_key_set= true;
}
@@ -179,9 +178,9 @@
It might be optimum to bounce the connection if count > some number.
*/
- for (x= 0; x < memcached_server_count(ptr); x++)
+ for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
- memcached_server_instance_st *instance=
+ memcached_server_write_instance_st instance=
memcached_server_instance_fetch(ptr, x);
if (memcached_server_response_count(instance))
@@ -197,8 +196,10 @@
}
if (ptr->flags.binary_protocol)
+ {
return binary_mget_by_key(ptr, master_server_key, is_master_key_set, keys,
key_length, number_of_keys, mget_mode);
+ }
if (ptr->flags.support_cas)
{
@@ -210,9 +211,9 @@
If a server fails we warn about errors and start all over with sending keys
to the server.
*/
- for (x= 0; x < number_of_keys; x++)
+ for (uint32_t x= 0; x < number_of_keys; x++)
{
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
uint32_t server_key;
if (is_master_key_set)
@@ -221,11 +222,20 @@
}
else
{
- server_key= memcached_generate_hash(ptr, keys[x], key_length[x]);
+ server_key= memcached_generate_hash_with_redistribution(ptr, keys[x], key_length[x]);
}
instance= memcached_server_instance_fetch(ptr, server_key);
+ struct __write_vector_st vector[]=
+ {
+ { .length= get_command_length, .buffer= get_command },
+ { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
+ { .length= key_length[x], .buffer= keys[x] },
+ { .length= 1, .buffer= " " }
+ };
+
+
if (memcached_server_response_count(instance) == 0)
{
rc= memcached_connect(instance);
@@ -233,7 +243,7 @@
if (rc != MEMCACHED_SUCCESS)
continue;
- if ((memcached_io_write(instance, get_command, get_command_length, false)) == -1)
+ if ((memcached_io_writev(instance, vector, 4, false)) == -1)
{
rc= MEMCACHED_SOME_ERRORS;
continue;
@@ -242,39 +252,23 @@
memcached_server_response_increment(instance);
WATCHPOINT_ASSERT(instance->cursor_active == 1);
}
-
- /* Only called when we have a prefix key */
- if (ptr->prefix_key_length)
+ else
{
- if ((memcached_io_write(instance, ptr->prefix_key, ptr->prefix_key_length, false)) == -1)
+ if ((memcached_io_writev(instance, (vector + 1), 3, false)) == -1)
{
memcached_server_response_reset(instance);
rc= MEMCACHED_SOME_ERRORS;
continue;
}
}
-
- if ((memcached_io_write(instance, keys[x], key_length[x], false)) == -1)
- {
- memcached_server_response_reset(instance);
- rc= MEMCACHED_SOME_ERRORS;
- continue;
- }
-
- if ((memcached_io_write(instance, " ", 1, false)) == -1)
- {
- memcached_server_response_reset(instance);
- rc= MEMCACHED_SOME_ERRORS;
- continue;
- }
}
/*
Should we muddle on if some servers are dead?
*/
- for (x= 0; x < memcached_server_count(ptr); x++)
+ for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
- memcached_server_instance_st *instance=
+ memcached_server_write_instance_st instance=
memcached_server_instance_fetch(ptr, x);
if (memcached_server_response_count(instance))
@@ -351,7 +345,6 @@
size_t number_of_keys, bool mget_mode)
{
memcached_return_t rc= MEMCACHED_NOTFOUND;
- uint32_t x;
int flush= number_of_keys == 1;
@@ -359,10 +352,10 @@
If a server fails we warn about errors and start all over with sending keys
to the server.
*/
- for (x= 0; x < number_of_keys; x++)
+ for (uint32_t x= 0; x < number_of_keys; ++x)
{
uint32_t server_key;
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
if (is_master_key_set)
{
@@ -370,7 +363,7 @@
}
else
{
- server_key= memcached_generate_hash(ptr, keys[x], key_length[x]);
+ server_key= memcached_generate_hash_with_redistribution(ptr, keys[x], key_length[x]);
}
instance= memcached_server_instance_fetch(ptr, server_key);
@@ -402,14 +395,18 @@
return vk;
}
- request.message.header.request.keylen= htons((uint16_t)key_length[x]);
+ request.message.header.request.keylen= htons((uint16_t)(key_length[x] + ptr->prefix_key_length));
request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
- request.message.header.request.bodylen= htonl((uint32_t) key_length[x]);
+ request.message.header.request.bodylen= htonl((uint32_t)( key_length[x] + ptr->prefix_key_length));
- if ((memcached_io_write(instance, request.bytes,
- sizeof(request.bytes), false) == -1) ||
- (memcached_io_write(instance, keys[x],
- key_length[x], flush) == -1))
+ struct __write_vector_st vector[]=
+ {
+ { .length= sizeof(request.bytes), .buffer= request.bytes },
+ { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
+ { .length= key_length[x], .buffer= keys[x] }
+ };
+
+ if (memcached_io_writev(instance, vector, 3, flush) == -1)
{
memcached_server_response_reset(instance);
rc= MEMCACHED_SOME_ERRORS;
@@ -419,9 +416,10 @@
/* We just want one pending response per server */
memcached_server_response_reset(instance);
memcached_server_response_increment(instance);
- if ((x > 0 && x == ptr->io_key_prefetch) &&
- memcached_flush_buffers(ptr) != MEMCACHED_SUCCESS)
+ if ((x > 0 && x == ptr->io_key_prefetch) && memcached_flush_buffers(ptr) != MEMCACHED_SUCCESS)
+ {
rc= MEMCACHED_SOME_ERRORS;
+ }
}
if (mget_mode)
@@ -434,9 +432,9 @@
request.message.header.request.opcode= PROTOCOL_BINARY_CMD_NOOP;
request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
- for (x= 0; x < memcached_server_count(ptr); x++)
+ for (uint32_t x= 0; x < memcached_server_count(ptr); ++x)
{
- memcached_server_instance_st *instance=
+ memcached_server_write_instance_st instance=
memcached_server_instance_fetch(ptr, x);
if (memcached_server_response_count(instance))
@@ -471,7 +469,7 @@
size_t number_of_keys)
{
memcached_return_t rc= MEMCACHED_NOTFOUND;
- uint32_t x, start= 0;
+ uint32_t start= 0;
uint64_t randomize_read= memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ);
if (randomize_read)
@@ -482,9 +480,9 @@
{
bool success= true;
- for (x= 0; x < number_of_keys; ++x)
+ for (uint32_t x= 0; x < number_of_keys; ++x)
{
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
if (hash[x] == memcached_server_count(ptr))
continue; /* Already successfully sent */
@@ -519,9 +517,9 @@
.message.header.request= {
.magic= PROTOCOL_BINARY_REQ,
.opcode= PROTOCOL_BINARY_CMD_GETK,
- .keylen= htons((uint16_t)key_length[x]),
+ .keylen= htons((uint16_t)(key_length[x] + ptr->prefix_key_length)),
.datatype= PROTOCOL_BINARY_RAW_BYTES,
- .bodylen= htonl((uint32_t)key_length[x])
+ .bodylen= htonl((uint32_t)(key_length[x] + ptr->prefix_key_length))
}
};
@@ -535,10 +533,14 @@
* that we might have processed some of the responses etc. For now,
* just make sure we work _correctly_
*/
- if ((memcached_io_write(instance, request.bytes,
- sizeof(request.bytes), false) == -1) ||
- (memcached_io_write(instance, keys[x],
- key_length[x], true) == -1))
+ struct __write_vector_st vector[]=
+ {
+ { .length= sizeof(request.bytes), .buffer= request.bytes },
+ { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
+ { .length= key_length[x], .buffer= keys[x] }
+ };
+
+ if (memcached_io_writev(instance, vector, 3, true) == -1)
{
memcached_io_reset(instance);
dead_servers[server]= true;
@@ -598,7 +600,7 @@
{
for (size_t x= 0; x < number_of_keys; x++)
{
- hash[x]= memcached_generate_hash(ptr, keys[x], key_length[x]);
+ hash[x]= memcached_generate_hash_with_redistribution(ptr, keys[x], key_length[x]);
}
}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/hash.c
^
|
@@ -17,22 +17,12 @@
return libhashkit_digest(key, key_length, (hashkit_hash_algorithm_t)hash_algorithm);
}
-uint32_t generate_hash(memcached_st *ptr, const char *key, size_t key_length)
+static inline uint32_t generate_hash(const memcached_st *ptr, const char *key, size_t key_length)
{
- uint32_t hash= 1; /* Just here to remove compile warning */
-
-
- WATCHPOINT_ASSERT(memcached_server_count(ptr));
-
- if (memcached_server_count(ptr) == 1)
- return 0;
-
- hash= hashkit_digest(&ptr->hashkit, key, key_length);
-
- return hash;
+ return hashkit_digest(&ptr->hashkit, key, key_length);
}
-static uint32_t dispatch_host(memcached_st *ptr, uint32_t hash)
+static uint32_t dispatch_host(const memcached_st *ptr, uint32_t hash)
{
switch (ptr->distribution)
{
@@ -73,13 +63,10 @@
}
/*
- One day make this public, and have it return the actual memcached_server_st
- to the calling application.
+ One version is public and will not modify the distribution hash, the other will.
*/
-uint32_t memcached_generate_hash(memcached_st *ptr, const char *key, size_t key_length)
+static inline uint32_t _generate_hash_wrapper(const memcached_st *ptr, const char *key, size_t key_length)
{
- uint32_t hash= 1; /* Just here to remove compile warning */
-
WATCHPOINT_ASSERT(memcached_server_count(ptr));
if (memcached_server_count(ptr) == 1)
@@ -95,14 +82,18 @@
strncpy(temp, ptr->prefix_key, ptr->prefix_key_length);
strncpy(temp + ptr->prefix_key_length, key, key_length);
- hash= generate_hash(ptr, temp, temp_length);
+
+ return generate_hash(ptr, temp, temp_length);
}
else
{
- hash= generate_hash(ptr, key, key_length);
+ return generate_hash(ptr, key, key_length);
}
+}
- if (memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS) && ptr->next_distribution_rebuild)
+static inline void _regen_for_auto_eject(memcached_st *ptr)
+{
+ if (_is_auto_eject_host(ptr) && ptr->next_distribution_rebuild)
{
struct timeval now;
@@ -112,11 +103,36 @@
run_distribution(ptr);
}
}
+}
+
+void memcached_autoeject(memcached_st *ptr)
+{
+ _regen_for_auto_eject(ptr);
+}
+
+uint32_t memcached_generate_hash_with_redistribution(memcached_st *ptr, const char *key, size_t key_length)
+{
+ uint32_t hash= _generate_hash_wrapper(ptr, key, key_length);
+
+ _regen_for_auto_eject(ptr);
return dispatch_host(ptr, hash);
}
-hashkit_st *memcached_get_hashkit(memcached_st *ptr)
+uint32_t memcached_generate_hash(const memcached_st *ptr, const char *key, size_t key_length)
+{
+ return dispatch_host(ptr, _generate_hash_wrapper(ptr, key, key_length));
+}
+
+const hashkit_st *memcached_get_hashkit(const memcached_st *ptr)
{
return &ptr->hashkit;
}
+
+memcached_return_t memcached_set_hashkit(memcached_st *self, hashkit_st *hashk)
+{
+ hashkit_free(&self->hashkit);
+ hashkit_clone(&self->hashkit, hashk);
+
+ return MEMCACHED_SUCCESS;
+}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/hash.h
^
|
@@ -21,11 +21,19 @@
uint32_t memcached_generate_hash_value(const char *key, size_t key_length, memcached_hash_t hash_algorithm);
LIBMEMCACHED_API
-hashkit_st *memcached_get_hashkit(memcached_st *ptr);
+const hashkit_st *memcached_get_hashkit(const memcached_st *ptr);
LIBMEMCACHED_API
-uint32_t memcached_generate_hash(memcached_st *ptr, const char *key, size_t key_length);
+memcached_return_t memcached_set_hashkit(memcached_st *ptr, hashkit_st *hashk);
+LIBMEMCACHED_API
+uint32_t memcached_generate_hash(const memcached_st *ptr, const char *key, size_t key_length);
+
+LIBMEMCACHED_LOCAL
+uint32_t memcached_generate_hash_with_redistribution(memcached_st *ptr, const char *key, size_t key_length);
+
+LIBMEMCACHED_API
+void memcached_autoeject(memcached_st *ptr);
#ifdef __cplusplus
}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/hosts.c
^
|
@@ -22,8 +22,8 @@
static int compare_servers(const void *p1, const void *p2)
{
int return_value;
- memcached_server_instance_st *a= (memcached_server_instance_st *)p1;
- memcached_server_instance_st *b= (memcached_server_instance_st *)p2;
+ memcached_server_instance_st a= (memcached_server_instance_st)p1;
+ memcached_server_instance_st b= (memcached_server_instance_st)p2;
return_value= strcmp(a->hostname, b->hostname);
@@ -39,9 +39,9 @@
{
if (memcached_server_count(ptr))
{
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
- qsort(memcached_server_list(ptr), memcached_server_count(ptr), sizeof(memcached_server_instance_st), compare_servers);
+ qsort(memcached_server_list(ptr), memcached_server_count(ptr), sizeof(memcached_server_st), compare_servers);
instance= memcached_server_instance_fetch(ptr, 0);
instance->number_of_hosts= memcached_server_count(ptr);
}
@@ -69,8 +69,6 @@
WATCHPOINT_ASSERT(0); /* We have added a distribution without extending the logic */
}
- ptr->last_disconnected_server = NULL;
-
return MEMCACHED_SUCCESS;
}
@@ -106,7 +104,7 @@
uint32_t host_index;
uint32_t continuum_index= 0;
uint32_t value;
- memcached_server_instance_st *list;
+ memcached_server_st *list;
uint32_t pointer_index;
uint32_t pointer_counter= 0;
uint32_t pointer_per_server= MEMCACHED_POINTS_PER_SERVER;
@@ -127,7 +125,7 @@
list = memcached_server_list(ptr);
/* count live servers (those without a retry delay set) */
- is_auto_ejecting= memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS);
+ is_auto_ejecting= _is_auto_eject_host(ptr);
if (is_auto_ejecting)
{
live_servers= 0;
@@ -176,12 +174,12 @@
{
list[host_index].weight = 1;
}
- if (!is_auto_ejecting || list[host_index].next_retry <= now.tv_sec)
+ if (! is_auto_ejecting || list[host_index].next_retry <= now.tv_sec)
total_weight += list[host_index].weight;
}
}
- for (host_index = 0; host_index < memcached_server_count(ptr); ++host_index)
+ for (host_index= 0; host_index < memcached_server_count(ptr); ++host_index)
{
if (is_auto_ejecting && list[host_index].next_retry > now.tv_sec)
continue;
@@ -305,7 +303,7 @@
}
-memcached_return_t memcached_server_push(memcached_st *ptr, memcached_server_st *list)
+memcached_return_t memcached_server_push(memcached_st *ptr, const memcached_server_list_st list)
{
uint32_t count;
memcached_server_st *new_host_list;
@@ -313,9 +311,9 @@
if (! list)
return MEMCACHED_SUCCESS;
- count= memcached_servers_count(list);
+ count= memcached_server_list_count(list);
new_host_list= libmemcached_realloc(ptr, memcached_server_list(ptr),
- sizeof(memcached_server_instance_st) * (count + memcached_server_count(ptr)));
+ sizeof(memcached_server_st) * (count + memcached_server_count(ptr)));
if (! new_host_list)
return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
@@ -324,7 +322,7 @@
for (uint32_t x= 0; x < count; x++)
{
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
if ((ptr->flags.use_udp && list[x].type != MEMCACHED_CONNECTION_UDP)
|| ((list[x].type == MEMCACHED_CONNECTION_UDP)
@@ -343,7 +341,7 @@
// Provides backwards compatibility with server list.
{
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
instance= memcached_server_instance_fetch(ptr, 0);
instance->number_of_hosts= memcached_server_count(ptr);
}
@@ -414,15 +412,15 @@
uint32_t weight,
memcached_connection_t type)
{
- memcached_server_instance_st *new_host_list;
- memcached_server_instance_st *instance;
+ memcached_server_st *new_host_list;
+ memcached_server_write_instance_st instance;
if ( (ptr->flags.use_udp && type != MEMCACHED_CONNECTION_UDP)
|| ( (type == MEMCACHED_CONNECTION_UDP) && (! ptr->flags.use_udp) ) )
return MEMCACHED_INVALID_HOST_PROTOCOL;
new_host_list= libmemcached_realloc(ptr, memcached_server_list(ptr),
- sizeof(memcached_server_instance_st) * (ptr->number_of_hosts + 1));
+ sizeof(memcached_server_st) * (ptr->number_of_hosts + 1));
if (new_host_list == NULL)
return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/include.am
^
|
@@ -44,7 +44,9 @@
libmemcached/protocol_handler.h \
libmemcached/quit.h \
libmemcached/result.h \
+ libmemcached/sasl.h \
libmemcached/server.h \
+ libmemcached/server_list.h \
libmemcached/stats.h \
libmemcached/storage.h \
libmemcached/strerror.h \
@@ -63,7 +65,7 @@
libmemcached/protocol/pedantic.c \
libmemcached/protocol/protocol_handler.c
-libmemcached_libmemcachedprotocol_la_LDFLAGS= ${AM_LDFLAGS} -version-info 0:0:0
+libmemcached_libmemcachedprotocol_la_LDFLAGS= ${AM_LDFLAGS} -version-info 0:0:0
noinst_LTLIBRARIES+= \
libmemcached/libmemcachedcallbacks.la
@@ -137,6 +139,11 @@
libmemcached_libmemcachedprotocol_la_DEPENDENCIES=libmemcached/libbyteorder.la
endif
+if HAVE_SASL
+libmemcached_libmemcached_la_LDFLAGS+= $(LIBSASL)
+libmemcached_libmemcached_la_SOURCES += libmemcached/sasl.c
+endif
+
if HAVE_DTRACE
BUILT_SOURCES+= libmemcached/dtrace_probes.h
libmemcached_libmemcached_la_SOURCES += libmemcached/libmemcached_probes.d
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/io.c
^
|
@@ -19,10 +19,11 @@
MEM_WRITE
} memc_read_or_write;
-static ssize_t io_flush(memcached_server_instance_st *ptr, memcached_return_t *error);
-static void increment_udp_message_id(memcached_server_instance_st *ptr);
+static ssize_t io_flush(memcached_server_write_instance_st ptr,
+ memcached_return_t *error);
+static void increment_udp_message_id(memcached_server_write_instance_st ptr);
-static memcached_return_t io_wait(memcached_server_instance_st *ptr,
+static memcached_return_t io_wait(memcached_server_write_instance_st ptr,
memc_read_or_write read_or_write)
{
struct pollfd fds= {
@@ -31,8 +32,15 @@
};
int error;
- unlikely (read_or_write == MEM_WRITE) /* write */
+ if (read_or_write == MEM_WRITE) /* write */
+ {
fds.events= POLLOUT;
+ WATCHPOINT_SET(ptr->io_wait_count.write++);
+ }
+ else
+ {
+ WATCHPOINT_SET(ptr->io_wait_count.read++);
+ }
/*
** We are going to block on write, but at least on Solaris we might block
@@ -61,22 +69,35 @@
switch (error)
{
case 1:
+ WATCHPOINT_IF_LABELED_NUMBER(read_or_write && loop_max < 4, "read() times we had to loop, decremented down from 5", loop_max);
+ WATCHPOINT_IF_LABELED_NUMBER(!read_or_write && loop_max < 4, "write() times we had to loop, decremented down from 5", loop_max);
+
return MEMCACHED_SUCCESS;
case 0:
return MEMCACHED_TIMEOUT;
+ default:
+ WATCHPOINT_ERRNO(errno);
+ {
+ switch (errno)
+ {
#ifdef TARGET_OS_LINUX
- case ERESTART:
+ case ERESTART:
#endif
- case EINTR:
- continue;
- default:
- ptr->cached_errno= error;
- memcached_quit_server(ptr, true);
+ case EINTR:
+ continue;
+ default:
+ ptr->cached_errno= error;
+ memcached_quit_server(ptr, true);
- return MEMCACHED_FAILURE;
+ return MEMCACHED_FAILURE;
+ }
+ }
}
}
+ if (loop_max == 0 && error == 0)
+ return MEMCACHED_TIMEOUT;
+
/* Imposssible for anything other then -1 */
WATCHPOINT_ASSERT(error == -1);
ptr->cached_errno= error;
@@ -91,7 +112,7 @@
*
* @param ptr the server to pack
*/
-static bool repack_input_buffer(memcached_server_instance_st *ptr)
+static bool repack_input_buffer(memcached_server_write_instance_st ptr)
{
if (ptr->read_ptr != ptr->read_buffer)
{
@@ -131,7 +152,7 @@
* @param ptr the server to star processing iput messages for
* @return true if we processed anything, false otherwise
*/
-static bool process_input_buffer(memcached_server_instance_st *ptr)
+static bool process_input_buffer(memcached_server_write_instance_st ptr)
{
/*
** We might be able to process some of the response messages if we
@@ -234,7 +255,7 @@
}
#endif
-memcached_return_t memcached_io_read(memcached_server_instance_st *ptr,
+memcached_return_t memcached_io_read(memcached_server_write_instance_st ptr,
void *buffer, size_t length, ssize_t *nread)
{
char *buffer_ptr;
@@ -251,11 +272,13 @@
{
data_read= read(ptr->fd, ptr->read_buffer, MEMCACHED_MAX_BUFFER);
if (data_read > 0)
+ {
break;
+ }
else if (data_read == -1)
{
ptr->cached_errno= errno;
- memcached_return_t rc= MEMCACHED_UNKNOWN_READ_FAILURE;
+ memcached_return_t rc= MEMCACHED_ERRNO;
switch (errno)
{
case EAGAIN:
@@ -286,6 +309,7 @@
for blocking I/O we do not return 0 and for non-blocking case
it will return EGAIN if data is not immediatly available.
*/
+ WATCHPOINT_STRING("We had a zero length read()");
memcached_quit_server(ptr, true);
*nread= -1;
return MEMCACHED_UNKNOWN_READ_FAILURE;
@@ -325,8 +349,8 @@
return MEMCACHED_SUCCESS;
}
-ssize_t memcached_io_write(memcached_server_instance_st *ptr,
- const void *buffer, size_t length, bool with_flush)
+static ssize_t _io_write(memcached_server_write_instance_st ptr,
+ const void *buffer, size_t length, bool with_flush)
{
size_t original_length;
const char* buffer_ptr;
@@ -402,7 +426,42 @@
return (ssize_t) original_length;
}
-memcached_return_t memcached_io_close(memcached_server_instance_st *ptr)
+ssize_t memcached_io_write(memcached_server_write_instance_st ptr,
+ const void *buffer, size_t length, bool with_flush)
+{
+ return _io_write(ptr, buffer, length, with_flush);
+}
+
+ssize_t memcached_io_writev(memcached_server_write_instance_st ptr,
+ const struct __write_vector_st *vector,
+ size_t number_of, bool with_flush)
+{
+ ssize_t total= 0;
+
+ for (size_t x= 0; x < number_of; x++, vector++)
+ {
+ ssize_t returnable;
+
+ if ((returnable= _io_write(ptr, vector->buffer, vector->length, false)) == -1)
+ {
+ return -1;
+ }
+ total+= returnable;
+ }
+
+ if (with_flush)
+ {
+ if (memcached_io_write(ptr, NULL, 0, true) == -1)
+ {
+ return -1;
+ }
+ }
+
+ return total;
+}
+
+
+memcached_return_t memcached_io_close(memcached_server_write_instance_st ptr)
{
if (ptr->fd == -1)
{
@@ -425,7 +484,7 @@
return MEMCACHED_SUCCESS;
}
-memcached_server_instance_st *memcached_io_get_readable_server(memcached_st *memc)
+memcached_server_write_instance_st memcached_io_get_readable_server(memcached_st *memc)
{
#define MAX_SERVERS_TO_POLL 100
struct pollfd fds[MAX_SERVERS_TO_POLL];
@@ -435,7 +494,7 @@
x< memcached_server_count(memc) && host_index < MAX_SERVERS_TO_POLL;
++x)
{
- memcached_server_instance_st *instance=
+ memcached_server_write_instance_st instance=
memcached_server_instance_fetch(memc, x);
if (instance->read_buffer_length > 0) /* I have data in the buffer */
@@ -455,7 +514,7 @@
/* We have 0 or 1 server with pending events.. */
for (uint32_t x= 0; x< memcached_server_count(memc); ++x)
{
- memcached_server_instance_st *instance=
+ memcached_server_write_instance_st instance=
memcached_server_instance_fetch(memc, x);
if (memcached_server_response_count(instance) > 0)
@@ -481,7 +540,7 @@
{
for (uint32_t y= 0; y < memcached_server_count(memc); ++y)
{
- memcached_server_instance_st *instance=
+ memcached_server_write_instance_st instance=
memcached_server_instance_fetch(memc, y);
if (instance->fd == fds[x].fd)
@@ -494,7 +553,7 @@
return NULL;
}
-static ssize_t io_flush(memcached_server_instance_st *ptr,
+static ssize_t io_flush(memcached_server_write_instance_st ptr,
memcached_return_t *error)
{
/*
@@ -547,6 +606,8 @@
if (sent_length == -1)
{
ptr->cached_errno= errno;
+ WATCHPOINT_ERRNO(errno);
+ WATCHPOINT_NUMBER(errno);
switch (errno)
{
case ENOBUFS:
@@ -610,7 +671,7 @@
/*
Eventually we will just kill off the server with the problem.
*/
-void memcached_io_reset(memcached_server_instance_st *ptr)
+void memcached_io_reset(memcached_server_write_instance_st ptr)
{
memcached_quit_server(ptr, true);
}
@@ -619,7 +680,7 @@
* Read a given number of bytes from the server and place it into a specific
* buffer. Reset the IO channel on this server if an error occurs.
*/
-memcached_return_t memcached_safe_read(memcached_server_instance_st *ptr,
+memcached_return_t memcached_safe_read(memcached_server_write_instance_st ptr,
void *dta,
size_t size)
{
@@ -640,7 +701,7 @@
return MEMCACHED_SUCCESS;
}
-memcached_return_t memcached_io_readline(memcached_server_instance_st *ptr,
+memcached_return_t memcached_io_readline(memcached_server_write_instance_st ptr,
char *buffer_ptr,
size_t size)
{
@@ -698,7 +759,7 @@
* extracts the message number from message_id, increments it and then
* writes the new value back into the header
*/
-static void increment_udp_message_id(memcached_server_instance_st *ptr)
+static void increment_udp_message_id(memcached_server_write_instance_st ptr)
{
struct udp_datagram_header_st *header= (struct udp_datagram_header_st *)ptr->write_buffer;
uint16_t cur_req= get_udp_datagram_request_id(header);
@@ -711,7 +772,7 @@
header->request_id= htons((uint16_t) (thread_id | msg_num));
}
-memcached_return_t memcached_io_init_udp_header(memcached_server_instance_st *ptr, uint16_t thread_id)
+memcached_return_t memcached_io_init_udp_header(memcached_server_write_instance_st ptr, uint16_t thread_id)
{
if (thread_id > UDP_REQUEST_ID_MAX_THREAD_ID)
return MEMCACHED_FAILURE;
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/io.h
^
|
@@ -40,38 +40,49 @@
uint16_t reserved;
};
+struct __write_vector_st
+{
+ size_t length;
+ const void *buffer;
+};
+
+LIBMEMCACHED_LOCAL
+ssize_t memcached_io_writev(memcached_server_write_instance_st ptr,
+ const struct __write_vector_st *vector,
+ size_t number_of, bool with_flush);
+
LIBMEMCACHED_LOCAL
-ssize_t memcached_io_write(memcached_server_instance_st *ptr,
+ssize_t memcached_io_write(memcached_server_write_instance_st ptr,
const void *buffer, size_t length, bool with_flush);
LIBMEMCACHED_LOCAL
-void memcached_io_reset(memcached_server_instance_st *ptr);
+void memcached_io_reset(memcached_server_write_instance_st ptr);
LIBMEMCACHED_LOCAL
-memcached_return_t memcached_io_read(memcached_server_instance_st *ptr,
+memcached_return_t memcached_io_read(memcached_server_write_instance_st ptr,
void *buffer, size_t length, ssize_t *nread);
/* Read a line (terminated by '\n') into the buffer */
LIBMEMCACHED_LOCAL
-memcached_return_t memcached_io_readline(memcached_server_instance_st *ptr,
+memcached_return_t memcached_io_readline(memcached_server_write_instance_st ptr,
char *buffer_ptr,
size_t size);
LIBMEMCACHED_LOCAL
-memcached_return_t memcached_io_close(memcached_server_instance_st *ptr);
+memcached_return_t memcached_io_close(memcached_server_write_instance_st ptr);
/* Read n bytes of data from the server and store them in dta */
LIBMEMCACHED_LOCAL
-memcached_return_t memcached_safe_read(memcached_server_instance_st *ptr,
+memcached_return_t memcached_safe_read(memcached_server_write_instance_st ptr,
void *dta,
size_t size);
LIBMEMCACHED_LOCAL
-memcached_return_t memcached_io_init_udp_header(memcached_server_instance_st *ptr,
+memcached_return_t memcached_io_init_udp_header(memcached_server_write_instance_st ptr,
uint16_t thread_id);
LIBMEMCACHED_LOCAL
-memcached_server_instance_st *memcached_io_get_readable_server(memcached_st *memc);
+memcached_server_write_instance_st memcached_io_get_readable_server(memcached_st *memc);
#ifdef __cplusplus
}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/memcached.c
^
|
@@ -5,7 +5,7 @@
* Use and distribution licensed under the BSD license. See
* the COPYING file in the parent directory for full text.
*
- * Summary:
+ * Summary:
*
*/
@@ -15,6 +15,7 @@
.state= {
.is_purging= false,
.is_processing_input= false,
+ .is_time_for_rebuild= false,
},
.flags= {
.auto_eject_hosts= false,
@@ -32,7 +33,8 @@
.use_cache_lookups= false,
.use_sort_hosts= false,
.use_udp= false,
- .verify_key= false
+ .verify_key= false,
+ .tcp_keepalive= false
}
};
@@ -62,10 +64,12 @@
self->io_msg_watermark= 500;
self->io_bytes_watermark= 65 * 1024;
+ self->tcp_keepidle= 0;
+
self->io_key_prefetch= 0;
self->cached_errno= 0;
self->poll_timeout= MEMCACHED_DEFAULT_TIMEOUT;
- self->connect_timeout= MEMCACHED_DEFAULT_TIMEOUT;
+ self->connect_timeout= MEMCACHED_DEFAULT_CONNECT_TIMEOUT;
self->retry_timeout= 0;
self->continuum_count= 0;
@@ -88,6 +92,7 @@
self->get_key_failure= NULL;
self->delete_trigger= NULL;
self->callbacks= NULL;
+ self->sasl= NULL;
return true;
}
@@ -132,55 +137,52 @@
return ptr;
}
-void server_list_free(memcached_st *ptr, memcached_server_st *servers)
-{
- uint32_t x;
-
- if (servers == NULL)
- return;
-
- for (x= 0; x < memcached_servers_count(servers); x++)
- {
- if (servers[x].address_info)
- {
- freeaddrinfo(servers[x].address_info);
- servers[x].address_info= NULL;
- }
- }
-
- if (ptr)
- {
- libmemcached_free(ptr, servers);
- }
- else
- {
- free(servers);
- }
-}
-
void memcached_servers_reset(memcached_st *ptr)
{
- server_list_free(ptr, memcached_server_list(ptr));
+ memcached_server_list_free(memcached_server_list(ptr));
memcached_server_list_set(ptr, NULL);
ptr->number_of_hosts= 0;
+ if (ptr->last_disconnected_server)
+ {
+ memcached_server_free(ptr->last_disconnected_server);
+ }
ptr->last_disconnected_server= NULL;
ptr->server_failure_limit= 0;
}
+void memcached_reset_last_disconnected_server(memcached_st *ptr)
+{
+ if (ptr->last_disconnected_server)
+ {
+ memcached_server_free(ptr->last_disconnected_server);
+ ptr->last_disconnected_server= NULL;
+ }
+}
+
void memcached_free(memcached_st *ptr)
{
/* If we have anything open, lets close it now */
memcached_quit(ptr);
- server_list_free(ptr, memcached_server_list(ptr));
+ memcached_server_list_free(memcached_server_list(ptr));
memcached_result_free(&ptr->result);
+ if (ptr->last_disconnected_server)
+ memcached_server_free(ptr->last_disconnected_server);
+
if (ptr->on_cleanup)
ptr->on_cleanup(ptr);
if (ptr->continuum)
libmemcached_free(ptr, ptr->continuum);
+ if (ptr->sasl)
+ {
+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+ memcached_destroy_sasl_auth_data(ptr);
+#endif
+ }
+
if (memcached_is_allocated(ptr))
{
libmemcached_free(ptr, ptr);
@@ -251,9 +253,10 @@
new_clone->io_bytes_watermark= source->io_bytes_watermark;
new_clone->io_key_prefetch= source->io_key_prefetch;
new_clone->number_of_replicas= source->number_of_replicas;
+ new_clone->tcp_keepidle= source->tcp_keepidle;
- if (memcached_server_list(source))
- rc= memcached_server_push(new_clone, memcached_server_list(source));
+ if (memcached_server_count(source))
+ rc= memcached_push(new_clone, source);
if (rc != MEMCACHED_SUCCESS)
{
@@ -269,6 +272,17 @@
new_clone->prefix_key_length= source->prefix_key_length;
}
+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+ if (source->sasl && source->sasl->callbacks)
+ {
+ if (memcached_clone_sasl(new_clone, source) != MEMCACHED_SUCCESS)
+ {
+ memcached_free(new_clone);
+ return NULL;
+ }
+ }
+#endif
+
rc= run_distribution(new_clone);
if (rc != MEMCACHED_SUCCESS)
@@ -296,3 +310,18 @@
return ret;
}
+
+memcached_return_t memcached_push(memcached_st *destination, const memcached_st *source)
+{
+ return memcached_server_push(destination, source->servers);
+}
+
+memcached_server_write_instance_st memcached_server_instance_fetch(memcached_st *ptr, uint32_t server_key)
+{
+ return &ptr->servers[server_key];
+}
+
+memcached_server_instance_st memcached_server_instance_by_position(const memcached_st *ptr, uint32_t server_key)
+{
+ return &ptr->servers[server_key];
+}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/memcached.h
^
|
@@ -48,37 +48,41 @@
#include <libmemcached/quit.h>
#include <libmemcached/result.h>
#include <libmemcached/server.h>
+#include <libmemcached/server_list.h>
#include <libmemcached/storage.h>
#include <libmemcached/strerror.h>
#include <libmemcached/verbosity.h>
#include <libmemcached/version.h>
+#include <libmemcached/sasl.h>
struct memcached_st {
/**
@note these are static and should not change without a call to behavior.
*/
struct {
- bool is_purging MEMCACHED_BITFIELD;
- bool is_processing_input MEMCACHED_BITFIELD;
+ bool is_purging:1;
+ bool is_processing_input:1;
+ bool is_time_for_rebuild:1;
} state;
struct {
// Everything below here is pretty static.
- bool auto_eject_hosts MEMCACHED_BITFIELD;
- bool binary_protocol MEMCACHED_BITFIELD;
- bool buffer_requests MEMCACHED_BITFIELD;
- bool cork MEMCACHED_BITFIELD;
- bool hash_with_prefix_key MEMCACHED_BITFIELD;
- bool ketama_weighted MEMCACHED_BITFIELD;
- bool no_block MEMCACHED_BITFIELD;
- bool no_reply MEMCACHED_BITFIELD;
- bool randomize_replica_read MEMCACHED_BITFIELD;
- bool reuse_memory MEMCACHED_BITFIELD;
- bool support_cas MEMCACHED_BITFIELD;
- bool tcp_nodelay MEMCACHED_BITFIELD;
- bool use_cache_lookups MEMCACHED_BITFIELD;
- bool use_sort_hosts MEMCACHED_BITFIELD;
- bool use_udp MEMCACHED_BITFIELD;
- bool verify_key MEMCACHED_BITFIELD;
+ bool auto_eject_hosts:1;
+ bool binary_protocol:1;
+ bool buffer_requests:1;
+ bool cork:1;
+ bool hash_with_prefix_key:1;
+ bool ketama_weighted:1;
+ bool no_block:1;
+ bool no_reply:1;
+ bool randomize_replica_read:1;
+ bool reuse_memory:1;
+ bool support_cas:1;
+ bool tcp_nodelay:1;
+ bool use_cache_lookups:1;
+ bool use_sort_hosts:1;
+ bool use_udp:1;
+ bool verify_key:1;
+ bool tcp_keepalive:1;
} flags;
memcached_server_distribution_t distribution;
hashkit_st hashkit;
@@ -92,6 +96,7 @@
uint32_t io_msg_watermark;
uint32_t io_bytes_watermark;
uint32_t io_key_prefetch;
+ uint32_t tcp_keepidle;
int cached_errno;
int32_t poll_timeout;
int32_t connect_timeout;
@@ -120,9 +125,10 @@
memcached_trigger_key_fn get_key_failure;
memcached_trigger_delete_key_fn delete_trigger;
memcached_callback_st *callbacks;
+ struct memcached_sasl_st *sasl;
char prefix_key[MEMCACHED_PREFIX_KEY_MAX_SIZE];
struct {
- bool is_allocated MEMCACHED_BITFIELD;
+ bool is_allocated:1;
} options;
};
@@ -141,6 +147,9 @@
void memcached_free(memcached_st *ptr);
LIBMEMCACHED_API
+void memcached_reset_last_disconnected_server(memcached_st *ptr);
+
+LIBMEMCACHED_API
memcached_st *memcached_clone(memcached_st *clone, const memcached_st *ptr);
LIBMEMCACHED_API
@@ -149,17 +158,20 @@
LIBMEMCACHED_API
void *memcached_set_user_data(memcached_st *ptr, void *data);
+LIBMEMCACHED_API
+memcached_return_t memcached_push(memcached_st *destination, const memcached_st *source);
+
+LIBMEMCACHED_API
+memcached_server_instance_st memcached_server_instance_by_position(const memcached_st *ptr, uint32_t server_key);
+
+LIBMEMCACHED_API
+uint32_t memcached_server_count(const memcached_st *);
+
#ifdef __cplusplus
} // extern "C"
#endif
-// Local Only Inline
-static inline memcached_server_st *memcached_server_instance_fetch(memcached_st *ptr, uint32_t server_key)
-{
- return &ptr->servers[server_key];
-}
-
#ifdef __cplusplus
class Memcached : private memcached_st {
public:
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/memcached.hpp
^
|
@@ -40,7 +40,6 @@
:
servers_list(),
memc(),
- servers(NULL),
result()
{
memcached_create(&memc);
@@ -50,12 +49,10 @@
:
servers_list(in_servers_list),
memc(),
- servers(NULL),
result()
{
memcached_create(&memc);
- servers= memcached_servers_parse(servers_list.c_str());
- memcached_server_push(&memc, servers);
+ init();
}
Memcache(const std::string &hostname,
@@ -63,24 +60,23 @@
:
servers_list(),
memc(),
- servers(NULL),
result()
{
memcached_create(&memc);
+
servers_list.append(hostname);
servers_list.append(":");
std::ostringstream strsmt;
strsmt << port;
servers_list.append(strsmt.str());
- servers= memcached_servers_parse(servers_list.c_str());
- memcached_server_push(&memc, servers);
+
+ init();
}
Memcache(memcached_st *clone)
:
servers_list(),
memc(),
- servers(NULL),
result()
{
memcached_clone(&memc, clone);
@@ -90,12 +86,10 @@
:
servers_list(rhs.servers_list),
memc(),
- servers(NULL),
result()
{
memcached_clone(&memc, const_cast<memcached_st *>(&rhs.getImpl()));
- servers= memcached_servers_parse(servers_list.c_str());
- memcached_server_push(&memc, servers);
+ init();
}
Memcache &operator=(const Memcache &rhs)
@@ -103,16 +97,23 @@
if (this != &rhs)
{
memcached_clone(&memc, const_cast<memcached_st *>(&rhs.getImpl()));
- servers= memcached_servers_parse(servers_list.c_str());
- memcached_server_push(&memc, servers);
+ init();
}
+
return *this;
}
~Memcache()
{
memcached_free(&memc);
- memcached_server_list_free(servers);
+ }
+
+ void init()
+ {
+ memcached_server_st *servers;
+ servers= memcached_servers_parse(servers_list.c_str());
+ memcached_server_push(&memc, servers);
+ memcached_server_free(servers);
}
/**
@@ -175,9 +176,9 @@
bool setServers(const std::string &in_servers_list)
{
servers_list.assign(in_servers_list);
- servers= memcached_servers_parse(in_servers_list.c_str());
- memcached_server_push(&memc, servers);
- return (servers == NULL);
+ init();
+
+ return (memcached_server_count(&memc));
}
/**
@@ -190,17 +191,9 @@
bool addServer(const std::string &server_name, in_port_t port)
{
memcached_return_t rc;
- std::ostringstream strstm;
- servers_list.append(",");
- servers_list.append(server_name);
- servers_list.append(":");
- strstm << port;
- servers_list.append(strstm.str());
- servers= memcached_server_list_append(servers,
- server_name.c_str(),
- port,
- &rc);
- memcached_server_push(&memc, servers);
+
+ rc= memcached_server_add(&memc, server_name.c_str(), port);
+
return (rc == MEMCACHED_SUCCESS);
}
@@ -220,11 +213,10 @@
tmp_str.append(":");
strstm << port;
tmp_str.append(strstm.str());
- memcached_server_st *server= memcached_servers_parse(tmp_str.c_str());
- memcached_return_t rc= memcached_server_remove(server);
-
- return (rc == MEMCACHED_SUCCESS);
+ //memcached_return_t rc= memcached_server_remove(server);
+
+ return false;
}
/**
@@ -967,10 +959,12 @@
*/
for (uint32_t x= 0; x < server_count; x++)
{
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(&memc, x);
std::ostringstream strstm;
- std::string server_name(memcached_server_name(&memc, servers[x]));
+ std::string server_name(memcached_server_name(instance));
server_name.append(":");
- strstm << memcached_server_port(&memc, servers[x]);
+ strstm << memcached_server_port(instance);
server_name.append(strstm.str());
std::map<std::string, std::string> server_stats;
@@ -997,7 +991,6 @@
std::string servers_list;
memcached_st memc;
- memcached_server_st *servers;
memcached_result_st result;
};
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/memcached/protocol_binary.h
^
|
@@ -29,13 +29,16 @@
*
* Copy: See Copyright for the status of this software.
*
- * Author: Trond Norbye <trond.norbye@gmail.com>
+ * Author: Trond Norbye <trond.norbye@sun.com>
*/
#ifndef PROTOCOL_BINARY_H
#define PROTOCOL_BINARY_H
-#include <stdint.h>
+/**
+ * \addtogroup Protocol
+ * @{
+ */
/**
* This file contains definitions of the constants and packet formats
@@ -69,11 +72,14 @@
PROTOCOL_BINARY_RESPONSE_EINVAL = 0x04,
PROTOCOL_BINARY_RESPONSE_NOT_STORED = 0x05,
PROTOCOL_BINARY_RESPONSE_DELTA_BADVAL = 0x06,
+ PROTOCOL_BINARY_RESPONSE_AUTH_ERROR = 0x20,
+ PROTOCOL_BINARY_RESPONSE_AUTH_CONTINUE = 0x21,
PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND = 0x81,
PROTOCOL_BINARY_RESPONSE_ENOMEM = 0x82,
PROTOCOL_BINARY_RESPONSE_PAUSE = 0xfe00,
PROTOCOL_BINARY_RESPONSE_EIO = 0xff00
+
} protocol_binary_response_status;
/**
@@ -109,6 +115,10 @@
PROTOCOL_BINARY_CMD_APPENDQ = 0x19,
PROTOCOL_BINARY_CMD_PREPENDQ = 0x1a,
+ PROTOCOL_BINARY_CMD_SASL_LIST_MECHS = 0x20,
+ PROTOCOL_BINARY_CMD_SASL_AUTH = 0x21,
+ PROTOCOL_BINARY_CMD_SASL_STEP = 0x22,
+
/* These commands are used for range operations and exist within
* this header for use in other projects. Range operations are
* not expected to be implemented in the memcached server itself.
@@ -415,6 +425,10 @@
typedef protocol_binary_request_rangeop protocol_binary_request_rdecr;
typedef protocol_binary_request_rangeop protocol_binary_request_rdecrq;
+ /**
+ * @}
+ */
+
#ifdef __cplusplus
}
#endif
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/parse.c
^
|
@@ -7,7 +7,7 @@
#include "common.h"
-memcached_server_st *memcached_servers_parse(const char *server_strings)
+memcached_server_list_st memcached_servers_parse(const char *server_strings)
{
char *string;
in_port_t port;
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/parse.h
^
|
@@ -17,7 +17,7 @@
#endif
LIBMEMCACHED_API
-memcached_server_st *memcached_servers_parse(const char *server_strings);
+memcached_server_list_st memcached_servers_parse(const char *server_strings);
#ifdef __cplusplus
}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/protocol/ascii_handler.c
^
|
@@ -386,7 +386,7 @@
else
{
char msg[80];
- snprintf(msg, sizeof(msg), "SERVER_ERROR: delete failed %u\r\n",(int)rval);
+ snprintf(msg, sizeof(msg), "SERVER_ERROR: delete failed %u\r\n",(uint32_t)rval);
spool_string(client, msg);
}
}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/purge.c
^
|
@@ -1,6 +1,6 @@
#include "common.h"
-memcached_return_t memcached_purge(memcached_server_instance_st *ptr)
+memcached_return_t memcached_purge(memcached_server_write_instance_st ptr)
{
uint32_t x;
memcached_return_t ret= MEMCACHED_SUCCESS;
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/quit.c
^
|
@@ -30,7 +30,7 @@
}
else
{
- rc= memcached_do(ptr, "quit\r\n", sizeof("quit\r\n"), true);
+ rc= memcached_do(ptr, "quit\r\n", strlen("quit\r\n"), true);
}
WATCHPOINT_ASSERT(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_FETCH_NOTFINISHED);
@@ -40,10 +40,17 @@
* closing the socket before all data is read
* results in server throwing away all data which is
* not read
+ *
+ * In .40 we began to only do this if we had been doing buffered
+ * requests of had replication enabled.
*/
- ssize_t nread;
- while (memcached_io_read(ptr, buffer, sizeof(buffer)/sizeof(*buffer),
- &nread) == MEMCACHED_SUCCESS);
+ if (ptr->root->flags.buffer_requests || ptr->root->number_of_replicas)
+ {
+ ssize_t nread;
+ while (memcached_io_read(ptr, buffer, sizeof(buffer)/sizeof(*buffer),
+ &nread) == MEMCACHED_SUCCESS);
+ }
+
/*
* memcached_io_read may call memcached_quit_server with io_death if
@@ -67,6 +74,7 @@
if (io_death)
{
ptr->server_failure_counter++;
+ set_last_disconnected_host(ptr);
}
}
@@ -81,7 +89,7 @@
{
for (x= 0; x < memcached_server_count(ptr); x++)
{
- memcached_server_instance_st *instance=
+ memcached_server_write_instance_st instance=
memcached_server_instance_fetch(ptr, x);
memcached_quit_server(instance, false);
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/quit.h
^
|
@@ -19,6 +19,9 @@
LIBMEMCACHED_API
void memcached_quit(memcached_st *ptr);
+LIBMEMCACHED_LOCAL
+void memcached_quit_server(memcached_server_st *ptr, bool io_death);
+
#ifdef __cplusplus
}
#endif
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/response.c
^
|
@@ -11,14 +11,14 @@
#include "common.h"
-static memcached_return_t textual_read_one_response(memcached_server_instance_st *ptr,
+static memcached_return_t textual_read_one_response(memcached_server_write_instance_st ptr,
char *buffer, size_t buffer_length,
memcached_result_st *result);
-static memcached_return_t binary_read_one_response(memcached_server_instance_st *ptr,
+static memcached_return_t binary_read_one_response(memcached_server_write_instance_st ptr,
char *buffer, size_t buffer_length,
memcached_result_st *result);
-memcached_return_t memcached_read_one_response(memcached_server_instance_st *ptr,
+memcached_return_t memcached_read_one_response(memcached_server_write_instance_st ptr,
char *buffer, size_t buffer_length,
memcached_result_st *result)
{
@@ -45,7 +45,7 @@
return rc;
}
-memcached_return_t memcached_response(memcached_server_instance_st *ptr,
+memcached_return_t memcached_response(memcached_server_write_instance_st ptr,
char *buffer, size_t buffer_length,
memcached_result_st *result)
{
@@ -58,7 +58,7 @@
/*
* The previous implementation purged all pending requests and just
* returned the last one. Purge all pending messages to ensure backwards
- * compatibility.
+ * compatibility.
*/
if (ptr->root->flags.binary_protocol == false)
while (memcached_server_response_count(ptr) > 1)
@@ -68,10 +68,10 @@
unlikely (rc != MEMCACHED_END &&
rc != MEMCACHED_STORED &&
rc != MEMCACHED_SUCCESS &&
- rc != MEMCACHED_STAT &&
+ rc != MEMCACHED_STAT &&
rc != MEMCACHED_DELETED &&
rc != MEMCACHED_NOTFOUND &&
- rc != MEMCACHED_NOTSTORED &&
+ rc != MEMCACHED_NOTSTORED &&
rc != MEMCACHED_DATA_EXISTS)
return rc;
}
@@ -79,7 +79,7 @@
return memcached_read_one_response(ptr, buffer, buffer_length, result);
}
-static memcached_return_t textual_value_fetch(memcached_server_instance_st *ptr,
+static memcached_return_t textual_value_fetch(memcached_server_write_instance_st ptr,
char *buffer,
memcached_result_st *result)
{
@@ -176,8 +176,8 @@
}
value_ptr= memcached_string_value_mutable(&result->value);
- /*
- We read the \r\n into the string since not doing so is more
+ /*
+ We read the \r\n into the string since not doing so is more
cycles then the waster of memory to do so.
We are null terminating through, which will most likely make
@@ -210,7 +210,7 @@
return MEMCACHED_PARTIAL_READ;
}
-static memcached_return_t textual_read_one_response(memcached_server_instance_st *ptr,
+static memcached_return_t textual_read_one_response(memcached_server_write_instance_st ptr,
char *buffer, size_t buffer_length,
memcached_result_st *result)
{
@@ -234,7 +234,6 @@
else
{
WATCHPOINT_STRING(buffer);
- WATCHPOINT_ASSERT(0);
return MEMCACHED_UNKNOWN_READ_FAILURE;
}
case 'O': /* OK */
@@ -246,21 +245,21 @@
memcached_server_response_increment(ptr);
return MEMCACHED_STAT;
}
- else if (buffer[1] == 'E') /* SERVER_ERROR */
+ else if (buffer[1] == 'E') /* SERVER_ERROR */
{
char *rel_ptr;
char *startptr= buffer + 13, *endptr= startptr;
while (*endptr != '\r' && *endptr != '\n') endptr++;
- /*
+ /*
Yes, we could make this "efficent" but to do that we would need
to maintain more state for the size of the buffer. Why waste
memory in the struct, which is important, for something that
rarely should happen?
*/
rel_ptr= (char *)libmemcached_realloc(ptr->root,
- ptr->cached_server_error,
+ ptr->cached_server_error,
(size_t) (endptr - startptr + 1));
if (rel_ptr == NULL)
@@ -281,7 +280,6 @@
else
{
WATCHPOINT_STRING(buffer);
- WATCHPOINT_ASSERT(0);
return MEMCACHED_UNKNOWN_READ_FAILURE;
}
}
@@ -294,7 +292,10 @@
else if (buffer[4] == 'S')
return MEMCACHED_NOTSTORED;
else
+ {
+ WATCHPOINT_STRING(buffer);
return MEMCACHED_UNKNOWN_READ_FAILURE;
+ }
}
case 'E': /* PROTOCOL ERROR or END */
{
@@ -305,7 +306,11 @@
else if (buffer[1] == 'X')
return MEMCACHED_DATA_EXISTS;
else
+ {
+ WATCHPOINT_STRING(buffer);
return MEMCACHED_UNKNOWN_READ_FAILURE;
+ }
+
}
case 'I': /* CLIENT ERROR */
/* We add back in one because we will need to search for END */
@@ -320,6 +325,7 @@
if (sscanf(buffer, "%llu", &auto_return_value) == 1)
return MEMCACHED_SUCCESS;
+ WATCHPOINT_STRING(buffer);
return MEMCACHED_UNKNOWN_READ_FAILURE;
}
}
@@ -327,18 +333,23 @@
/* NOTREACHED */
}
-static memcached_return_t binary_read_one_response(memcached_server_instance_st *ptr,
+static memcached_return_t binary_read_one_response(memcached_server_write_instance_st ptr,
char *buffer, size_t buffer_length,
memcached_result_st *result)
{
+ memcached_return_t rc;
protocol_binary_response_header header;
- unlikely (memcached_safe_read(ptr, &header.bytes,
- sizeof(header.bytes)) != MEMCACHED_SUCCESS)
- return MEMCACHED_UNKNOWN_READ_FAILURE;
+ if ((rc= memcached_safe_read(ptr, &header.bytes, sizeof(header.bytes))) != MEMCACHED_SUCCESS)
+ {
+ WATCHPOINT_ERROR(rc);
+ return rc;
+ }
- unlikely (header.response.magic != PROTOCOL_BINARY_RES)
+ if (header.response.magic != PROTOCOL_BINARY_RES)
+ {
return MEMCACHED_PROTOCOL_ERROR;
+ }
/*
** Convert the header to host local endian!
@@ -349,7 +360,8 @@
header.response.cas= ntohll(header.response.cas);
uint32_t bodylen= header.response.bodylen;
- if (header.response.status == 0)
+ if (header.response.status == PROTOCOL_BINARY_RESPONSE_SUCCESS ||
+ header.response.status == PROTOCOL_BINARY_RESPONSE_AUTH_CONTINUE)
{
switch (header.response.opcode)
{
@@ -357,8 +369,8 @@
/*
* We didn't increment the response counter for the GETKQ packet
* (only the final NOOP), so we need to increment the counter again.
- */
- memcached_server_response_increment(ptr);
+ */
+ memcached_server_response_increment(ptr);
/* FALLTHROUGH */
case PROTOCOL_BINARY_CMD_GETK:
{
@@ -366,53 +378,70 @@
memcached_result_reset(result);
result->item_cas= header.response.cas;
- if (memcached_safe_read(ptr, &result->item_flags,
- sizeof (result->item_flags)) != MEMCACHED_SUCCESS)
+ if ((rc= memcached_safe_read(ptr, &result->item_flags, sizeof (result->item_flags))) != MEMCACHED_SUCCESS)
+ {
+ WATCHPOINT_ERROR(rc);
return MEMCACHED_UNKNOWN_READ_FAILURE;
+ }
result->item_flags= ntohl(result->item_flags);
bodylen -= header.response.extlen;
result->key_length= keylen;
- if (memcached_safe_read(ptr, result->item_key, keylen) != MEMCACHED_SUCCESS)
+ if ((rc= memcached_safe_read(ptr, result->item_key, keylen)) != MEMCACHED_SUCCESS)
+ {
+ WATCHPOINT_ERROR(rc);
return MEMCACHED_UNKNOWN_READ_FAILURE;
+ }
bodylen -= keylen;
if (memcached_string_check(&result->value,
- bodylen) != MEMCACHED_SUCCESS)
+ bodylen) != MEMCACHED_SUCCESS)
return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
char *vptr= memcached_string_value_mutable(&result->value);
- if (memcached_safe_read(ptr, vptr, bodylen) != MEMCACHED_SUCCESS)
+ if ((rc= memcached_safe_read(ptr, vptr, bodylen)) != MEMCACHED_SUCCESS)
+ {
+ WATCHPOINT_ERROR(rc);
return MEMCACHED_UNKNOWN_READ_FAILURE;
+ }
- memcached_string_set_length(&result->value, bodylen);
- }
+ memcached_string_set_length(&result->value, bodylen);
+ }
break;
case PROTOCOL_BINARY_CMD_INCREMENT:
case PROTOCOL_BINARY_CMD_DECREMENT:
{
- if (bodylen != sizeof(uint64_t) || buffer_length != sizeof(uint64_t))
+ if (bodylen != sizeof(uint64_t) || buffer_length != sizeof(uint64_t))
return MEMCACHED_PROTOCOL_ERROR;
WATCHPOINT_ASSERT(bodylen == buffer_length);
uint64_t val;
- if (memcached_safe_read(ptr, &val, sizeof(val)) != MEMCACHED_SUCCESS)
+ if ((rc= memcached_safe_read(ptr, &val, sizeof(val))) != MEMCACHED_SUCCESS)
+ {
+ WATCHPOINT_ERROR(rc);
return MEMCACHED_UNKNOWN_READ_FAILURE;
+ }
val= ntohll(val);
memcpy(buffer, &val, sizeof(val));
- }
+ }
break;
+ case PROTOCOL_BINARY_CMD_SASL_LIST_MECHS:
case PROTOCOL_BINARY_CMD_VERSION:
{
memset(buffer, 0, buffer_length);
if (bodylen >= buffer_length)
+ {
/* not enough space in buffer.. should not happen... */
return MEMCACHED_UNKNOWN_READ_FAILURE;
- else if (memcached_safe_read(ptr, buffer, bodylen) != MEMCACHED_SUCCESS)
+ }
+ else if ((rc= memcached_safe_read(ptr, buffer, bodylen)) != MEMCACHED_SUCCESS)
+ {
+ WATCHPOINT_ERROR(rc);
return MEMCACHED_UNKNOWN_READ_FAILURE;
- }
+ }
+ }
break;
case PROTOCOL_BINARY_CMD_FLUSH:
case PROTOCOL_BINARY_CMD_QUIT:
@@ -425,7 +454,7 @@
{
WATCHPOINT_ASSERT(bodylen == 0);
return MEMCACHED_SUCCESS;
- }
+ }
case PROTOCOL_BINARY_CMD_NOOP:
{
WATCHPOINT_ASSERT(bodylen == 0);
@@ -434,38 +463,68 @@
case PROTOCOL_BINARY_CMD_STAT:
{
if (bodylen == 0)
+ {
return MEMCACHED_END;
+ }
else if (bodylen + 1 > buffer_length)
+ {
/* not enough space in buffer.. should not happen... */
return MEMCACHED_UNKNOWN_READ_FAILURE;
- else
+ }
+ else
{
- size_t keylen= header.response.keylen;
+ size_t keylen= header.response.keylen;
memset(buffer, 0, buffer_length);
- if (memcached_safe_read(ptr, buffer, keylen) != MEMCACHED_SUCCESS ||
- memcached_safe_read(ptr, buffer + keylen + 1,
- bodylen - keylen) != MEMCACHED_SUCCESS)
+ if ((rc= memcached_safe_read(ptr, buffer, keylen)) != MEMCACHED_SUCCESS ||
+ (rc= memcached_safe_read(ptr, buffer + keylen + 1, bodylen - keylen)) != MEMCACHED_SUCCESS)
+ {
+ WATCHPOINT_ERROR(rc);
return MEMCACHED_UNKNOWN_READ_FAILURE;
+ }
+ }
+ }
+ break;
+
+ case PROTOCOL_BINARY_CMD_SASL_AUTH:
+ case PROTOCOL_BINARY_CMD_SASL_STEP:
+ {
+ memcached_result_reset(result);
+ result->item_cas= header.response.cas;
+
+ if (memcached_string_check(&result->value,
+ bodylen) != MEMCACHED_SUCCESS)
+ return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
+
+ char *vptr= memcached_string_value_mutable(&result->value);
+ if ((rc= memcached_safe_read(ptr, vptr, bodylen)) != MEMCACHED_SUCCESS)
+ {
+ WATCHPOINT_ERROR(rc);
+ return MEMCACHED_UNKNOWN_READ_FAILURE;
}
- }
+
+ memcached_string_set_length(&result->value, bodylen);
+ }
break;
default:
{
/* Command not implemented yet! */
WATCHPOINT_ASSERT(0);
return MEMCACHED_PROTOCOL_ERROR;
- }
+ }
}
- }
- else if (header.response.bodylen)
+ }
+ else if (header.response.bodylen)
{
/* What should I do with the error message??? just discard it for now */
char hole[SMALL_STRING_LEN];
- while (bodylen > 0)
+ while (bodylen > 0)
{
size_t nr= (bodylen > SMALL_STRING_LEN) ? SMALL_STRING_LEN : bodylen;
- if (memcached_safe_read(ptr, hole, nr) != MEMCACHED_SUCCESS)
+ if ((rc= memcached_safe_read(ptr, hole, nr)) != MEMCACHED_SUCCESS)
+ {
+ WATCHPOINT_ERROR(rc);
return MEMCACHED_UNKNOWN_READ_FAILURE;
+ }
bodylen-= (uint32_t) nr;
}
@@ -486,9 +545,9 @@
}
}
- memcached_return_t rc= MEMCACHED_SUCCESS;
- unlikely(header.response.status != 0)
- switch (header.response.status)
+ rc= MEMCACHED_SUCCESS;
+ unlikely(header.response.status != 0)
+ switch (header.response.status)
{
case PROTOCOL_BINARY_RESPONSE_KEY_ENOENT:
rc= MEMCACHED_NOTFOUND;
@@ -505,6 +564,12 @@
case PROTOCOL_BINARY_RESPONSE_ENOMEM:
rc= MEMCACHED_MEMORY_ALLOCATION_FAILURE;
break;
+ case PROTOCOL_BINARY_RESPONSE_AUTH_CONTINUE:
+ rc= MEMCACHED_AUTH_CONTINUE;
+ break;
+ case PROTOCOL_BINARY_RESPONSE_AUTH_ERROR:
+ rc= MEMCACHED_AUTH_FAILURE;
+ break;
case PROTOCOL_BINARY_RESPONSE_EINVAL:
case PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND:
default:
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/response.h
^
|
@@ -18,12 +18,12 @@
/* Read a single response from the server */
LIBMEMCACHED_LOCAL
-memcached_return_t memcached_read_one_response(memcached_server_instance_st *ptr,
+memcached_return_t memcached_read_one_response(memcached_server_write_instance_st ptr,
char *buffer, size_t buffer_length,
memcached_result_st *result);
LIBMEMCACHED_LOCAL
-memcached_return_t memcached_response(memcached_server_instance_st *ptr,
+memcached_return_t memcached_response(memcached_server_write_instance_st ptr,
char *buffer, size_t buffer_length,
memcached_result_st *result);
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/result.c
^
|
@@ -94,3 +94,45 @@
{
return memcached_string_append(&ptr->value, value, length);
}
+
+const char *memcached_result_key_value(const memcached_result_st *self)
+{
+ return self->key_length ? self->item_key : NULL;
+}
+
+size_t memcached_result_key_length(const memcached_result_st *self)
+{
+ return self->key_length;
+}
+
+const char *memcached_result_value(const memcached_result_st *self)
+{
+ const memcached_string_st *sptr= &self->value;
+ return memcached_string_value(sptr);
+}
+
+size_t memcached_result_length(const memcached_result_st *self)
+{
+ const memcached_string_st *sptr= &self->value;
+ return memcached_string_length(sptr);
+}
+
+uint32_t memcached_result_flags(const memcached_result_st *self)
+{
+ return self->item_flags;
+}
+
+uint64_t memcached_result_cas(const memcached_result_st *self)
+{
+ return self->item_cas;
+}
+
+void memcached_result_set_flags(memcached_result_st *self, uint32_t flags)
+{
+ self->item_flags= flags;
+}
+
+void memcached_result_set_expiration(memcached_result_st *self, time_t expiration)
+{
+ self->item_expiration= expiration;
+}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/result.h
^
|
@@ -21,8 +21,8 @@
memcached_string_st value;
char item_key[MEMCACHED_MAX_KEY];
struct {
- bool is_allocated MEMCACHED_BITFIELD;
- bool is_initialized MEMCACHED_BITFIELD;
+ bool is_allocated:1;
+ bool is_initialized:1;
} options;
/* Add result callback function */
};
@@ -42,50 +42,32 @@
memcached_result_st *memcached_result_create(const memcached_st *ptr,
memcached_result_st *result);
-static inline const char *memcached_result_key_value(const memcached_result_st *self)
-{
- return self->key_length ? self->item_key : NULL;
-}
-
-static inline size_t memcached_result_key_length(const memcached_result_st *self)
-{
- return self->key_length;
-}
-
-static inline const char *memcached_result_value(const memcached_result_st *self)
-{
- const memcached_string_st *sptr= &self->value;
- return memcached_string_value(sptr);
-}
-
-static inline size_t memcached_result_length(const memcached_result_st *self)
-{
- const memcached_string_st *sptr= &self->value;
- return memcached_string_length(sptr);
-}
-
-static inline uint32_t memcached_result_flags(const memcached_result_st *self)
-{
- return self->item_flags;
-}
-
-static inline uint64_t memcached_result_cas(const memcached_result_st *self)
-{
- return self->item_cas;
-}
+LIBMEMCACHED_API
+const char *memcached_result_key_value(const memcached_result_st *self);
+
+LIBMEMCACHED_API
+size_t memcached_result_key_length(const memcached_result_st *self);
+
+LIBMEMCACHED_API
+const char *memcached_result_value(const memcached_result_st *self);
+
+LIBMEMCACHED_API
+size_t memcached_result_length(const memcached_result_st *self);
+
+LIBMEMCACHED_API
+uint32_t memcached_result_flags(const memcached_result_st *self);
+
+LIBMEMCACHED_API
+uint64_t memcached_result_cas(const memcached_result_st *self);
LIBMEMCACHED_API
memcached_return_t memcached_result_set_value(memcached_result_st *ptr, const char *value, size_t length);
-static inline void memcached_result_set_flags(memcached_result_st *self, uint32_t flags)
-{
- self->item_flags= flags;
-}
-
-static inline void memcached_result_set_expiration(memcached_result_st *self, time_t expiration)
-{
- self->item_expiration= expiration;
-}
+LIBMEMCACHED_API
+void memcached_result_set_flags(memcached_result_st *self, uint32_t flags);
+
+LIBMEMCACHED_API
+void memcached_result_set_expiration(memcached_result_st *self, time_t expiration);
#ifdef __cplusplus
} // extern "C"
|
[-]
[+]
|
Added |
libmemcached-0.40.tar.bz2/libmemcached/sasl.c
^
|
@@ -0,0 +1,385 @@
+/* LibMemcached
+ * Copyright (C) 2006-2010 Brian Aker
+ * All rights reserved.
+ *
+ * Use and distribution licensed under the BSD license. See
+ * the COPYING file in the parent directory for full text.
+ *
+ * Summary: interface for memcached server
+ * Description: main include file for libmemcached
+ *
+ */
+#include "common.h"
+
+void memcached_set_sasl_callbacks(memcached_st *ptr,
+ const sasl_callback_t *callbacks)
+{
+ ptr->sasl->callbacks= callbacks;
+ ptr->sasl->is_allocated= false;
+}
+
+const sasl_callback_t *memcached_get_sasl_callbacks(memcached_st *ptr)
+{
+ return ptr->sasl->callbacks;
+}
+
+/**
+ * Resolve the names for both ends of a connection
+ * @param fd socket to check
+ * @param laddr local address (out)
+ * @param raddr remote address (out)
+ * @return true on success false otherwise (errno contains more info)
+ */
+static bool resolve_names(int fd, char *laddr, char *raddr)
+{
+ char host[NI_MAXHOST];
+ char port[NI_MAXSERV];
+ struct sockaddr_storage saddr;
+ socklen_t salen= sizeof(saddr);
+
+ if ((getsockname(fd, (struct sockaddr *)&saddr, &salen) < 0) ||
+ (getnameinfo((struct sockaddr *)&saddr, salen, host, sizeof(host),
+ port, sizeof(port), NI_NUMERICHOST | NI_NUMERICSERV) < 0))
+ {
+ return false;
+ }
+
+ (void)sprintf(laddr, "%s;%s", host, port);
+ salen= sizeof(saddr);
+
+ if ((getpeername(fd, (struct sockaddr *)&saddr, &salen) < 0) ||
+ (getnameinfo((struct sockaddr *)&saddr, salen, host, sizeof(host),
+ port, sizeof(port), NI_NUMERICHOST | NI_NUMERICSERV) < 0))
+ {
+ return false;
+ }
+
+ (void)sprintf(raddr, "%s;%s", host, port);
+
+ return true;
+}
+
+memcached_return_t memcached_sasl_authenticate_connection(memcached_server_st *server)
+{
+ memcached_return_t rc;
+
+ /* SANITY CHECK: SASL can only be used with the binary protocol */
+ unlikely (!server->root->flags.binary_protocol)
+ return MEMCACHED_FAILURE;
+
+ /* Try to get the supported mech from the server. Servers without SASL
+ * support will return UNKNOWN COMMAND, so we can just treat that
+ * as authenticated
+ */
+ protocol_binary_request_no_extras request= {
+ .message.header.request= {
+ .magic= PROTOCOL_BINARY_REQ,
+ .opcode= PROTOCOL_BINARY_CMD_SASL_LIST_MECHS
+ }
+ };
+
+ if (memcached_io_write(server, request.bytes,
+ sizeof(request.bytes), 1) != sizeof(request.bytes))
+ {
+ return MEMCACHED_WRITE_FAILURE;
+ }
+
+ memcached_server_response_increment(server);
+
+ char mech[MEMCACHED_MAX_BUFFER];
+ rc= memcached_response(server, mech, sizeof(mech), NULL);
+ if (rc != MEMCACHED_SUCCESS)
+ {
+ if (rc == MEMCACHED_PROTOCOL_ERROR)
+ {
+ /* If the server doesn't support SASL it will return PROTOCOL_ERROR.
+ * This error may also be returned for other errors, but let's assume
+ * that the server don't support SASL and treat it as success and
+ * let the client fail with the next operation if the error was
+ * caused by another problem....
+ */
+ rc= MEMCACHED_SUCCESS;
+ }
+
+ return rc;
+ }
+
+ /* set ip addresses */
+ char laddr[NI_MAXHOST + NI_MAXSERV];
+ char raddr[NI_MAXHOST + NI_MAXSERV];
+
+ unlikely (!resolve_names(server->fd, laddr, raddr))
+ {
+ server->cached_errno= errno;
+ return MEMCACHED_ERRNO;
+ }
+
+ sasl_conn_t *conn;
+ int ret= sasl_client_new("memcached", server->hostname, laddr, raddr,
+ server->root->sasl->callbacks, 0, &conn);
+ if (ret != SASL_OK)
+ {
+ return MEMCACHED_AUTH_PROBLEM;
+ }
+
+ const char *data;
+ const char *chosenmech;
+ unsigned int len;
+ ret= sasl_client_start(conn, mech, NULL, &data, &len, &chosenmech);
+
+ if (ret != SASL_OK && ret != SASL_CONTINUE)
+ {
+ rc= MEMCACHED_AUTH_PROBLEM;
+ goto end;
+ }
+
+ uint16_t keylen= (uint16_t)strlen(chosenmech);
+ request.message.header.request.opcode= PROTOCOL_BINARY_CMD_SASL_AUTH;
+ request.message.header.request.keylen= htons(keylen);
+ request.message.header.request.bodylen= htonl(len + keylen);
+
+ do {
+ /* send the packet */
+
+ struct __write_vector_st vector[]=
+ {
+ { .length= sizeof(request.bytes), .buffer= request.bytes },
+ { .length= keylen, .buffer= chosenmech },
+ { .length= len, .buffer= data }
+ };
+
+ if (memcached_io_writev(server, vector, 3, true) == -1)
+ {
+ rc= MEMCACHED_WRITE_FAILURE;
+ goto end;
+ }
+ memcached_server_response_increment(server);
+
+ /* read the response */
+ rc= memcached_response(server, NULL, 0, NULL);
+ if (rc != MEMCACHED_AUTH_CONTINUE)
+ {
+ goto end;
+ }
+
+ ret= sasl_client_step(conn, memcached_result_value(&server->root->result),
+ (unsigned int)memcached_result_length(&server->root->result),
+ NULL, &data, &len);
+
+ if (ret != SASL_OK && ret != SASL_CONTINUE)
+ {
+ rc= MEMCACHED_AUTH_PROBLEM;
+ goto end;
+ }
+
+ request.message.header.request.opcode= PROTOCOL_BINARY_CMD_SASL_STEP;
+ request.message.header.request.bodylen= htonl(len + keylen);
+ } while (true);
+
+end:
+ /* Release resources */
+ sasl_dispose(&conn);
+
+ return rc;
+}
+
+static int get_username(void *context, int id, const char **result,
+ unsigned int *len)
+{
+ if (!context || !result || (id != SASL_CB_USER && id != SASL_CB_AUTHNAME))
+ {
+ return SASL_BADPARAM;
+ }
+
+ *result= context;
+ if (len)
+ {
+ *len= (unsigned int)strlen(*result);
+ }
+
+ return SASL_OK;
+}
+
+static int get_password(sasl_conn_t *conn, void *context, int id,
+ sasl_secret_t **psecret)
+{
+ if (!conn || ! psecret || id != SASL_CB_PASS)
+ {
+ return SASL_BADPARAM;
+ }
+
+ *psecret= context;
+
+ return SASL_OK;
+}
+
+memcached_return_t memcached_set_sasl_auth_data(memcached_st *ptr,
+ const char *username,
+ const char *password)
+{
+ if (ptr == NULL || username == NULL ||
+ password == NULL || ptr->sasl->callbacks != NULL)
+ {
+ return MEMCACHED_FAILURE;
+ }
+
+ sasl_callback_t *cb= libmemcached_calloc(ptr, 4, sizeof(sasl_callback_t));
+ char *name= libmemcached_malloc(ptr, strlen(username) + 1);
+ sasl_secret_t *secret= libmemcached_malloc(ptr, strlen(password) + 1 + sizeof(*secret))
+;
+ if (cb == NULL || name == NULL || secret == NULL)
+ {
+ libmemcached_free(ptr, cb);
+ libmemcached_free(ptr, name);
+ libmemcached_free(ptr, secret);
+ return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
+ }
+
+ secret->len= strlen(password);
+ strcpy((void*)secret->data, password);
+
+ cb[0].id= SASL_CB_USER;
+ cb[0].proc= get_username;
+ cb[0].context= strcpy(name, username);
+ cb[1].id= SASL_CB_AUTHNAME;
+ cb[1].proc= get_username;
+ cb[1].context= name;
+ cb[2].id= SASL_CB_PASS;
+ cb[2].proc= get_password;
+ cb[2].context= secret;
+ cb[3].id= SASL_CB_LIST_END;
+
+ ptr->sasl->callbacks= cb;
+ ptr->sasl->is_allocated= true;
+
+ return MEMCACHED_SUCCESS;
+}
+
+memcached_return_t memcached_destroy_sasl_auth_data(memcached_st *ptr)
+{
+ if (ptr == NULL || ptr->sasl->callbacks == NULL)
+ {
+ return MEMCACHED_FAILURE;
+ }
+
+ if (ptr->sasl->is_allocated)
+ {
+ libmemcached_free(ptr, ptr->sasl->callbacks[0].context);
+ libmemcached_free(ptr, ptr->sasl->callbacks[2].context);
+ libmemcached_free(ptr, (void*)ptr->sasl->callbacks);
+ ptr->sasl->is_allocated= false;
+ }
+
+ ptr->sasl->callbacks= NULL;
+ libmemcached_free(ptr, ptr->sasl);
+ ptr->sasl= NULL;
+
+ return MEMCACHED_SUCCESS;
+}
+
+memcached_return_t memcached_clone_sasl(memcached_st *clone, const memcached_st *source)
+{
+ if (source->sasl == NULL)
+ {
+ return MEMCACHED_SUCCESS;
+ }
+ else
+ {
+ clone->sasl= libmemcached_malloc(source, sizeof(struct memcached_sasl_st));
+
+ if (clone->sasl == NULL)
+ {
+ return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
+ }
+ }
+
+ /* Hopefully we are using our own callback mechanisms.. */
+ if (source->sasl->callbacks[0].id == SASL_CB_USER &&
+ source->sasl->callbacks[0].proc == get_username &&
+ source->sasl->callbacks[1].id == SASL_CB_AUTHNAME &&
+ source->sasl->callbacks[1].proc == get_username &&
+ source->sasl->callbacks[2].id == SASL_CB_PASS &&
+ source->sasl->callbacks[2].proc == get_password &&
+ source->sasl->callbacks[3].id == SASL_CB_LIST_END)
+ {
+ sasl_secret_t *secret= source->sasl->callbacks[2].context;
+ return memcached_set_sasl_auth_data(clone,
+ source->sasl->callbacks[0].context,
+ (const char*)secret->data);
+ }
+
+ /*
+ * But we're not. It may work if we know what the user tries to pass
+ * into the list, but if we don't know the ID we don't know how to handle
+ * the context...
+ */
+ size_t total= 0;
+
+ while (source->sasl->callbacks[total].id != SASL_CB_LIST_END)
+ {
+ switch (source->sasl->callbacks[total].id)
+ {
+ case SASL_CB_USER:
+ case SASL_CB_AUTHNAME:
+ case SASL_CB_PASS:
+ break;
+ default:
+ /* I don't know how to deal with this... */
+ return MEMCACHED_NOT_SUPPORTED;
+ }
+
+ ++total;
+ }
+
+ sasl_callback_t *cb= libmemcached_calloc(clone, total + 1, sizeof(sasl_callback_t));
+ if (cb == NULL)
+ {
+ return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
+ }
+ memcpy(cb, source->sasl->callbacks, (total + 1) * sizeof(sasl_callback_t));
+
+ /* Now update the context... */
+ for (size_t x= 0; x < total; ++x)
+ {
+ if (cb[x].id == SASL_CB_USER || cb[x].id == SASL_CB_AUTHNAME)
+ {
+ cb[x].context= libmemcached_malloc(clone, strlen(source->sasl->callbacks[x].context));
+
+ if (cb[x].context == NULL)
+ {
+ /* Failed to allocate memory, clean up previously allocated memory */
+ for (size_t y= 0; y < x; ++y)
+ {
+ libmemcached_free(clone, clone->sasl->callbacks[y].context);
+ }
+
+ libmemcached_free(clone, cb);
+ return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
+ }
+ strcpy(cb[x].context, source->sasl->callbacks[x].context);
+ }
+ else
+ {
+ sasl_secret_t *src = source->sasl->callbacks[x].context;
+ sasl_secret_t *n = libmemcached_malloc(clone, src->len + 1 + sizeof(*n));
+ if (n == NULL)
+ {
+ /* Failed to allocate memory, clean up previously allocated memory */
+ for (size_t y= 0; y < x; ++y)
+ {
+ libmemcached_free(clone, clone->sasl->callbacks[y].context);
+ }
+
+ libmemcached_free(clone, cb);
+ return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
+ }
+ memcpy(n, src, src->len + 1 + sizeof(*n));
+ cb[x].context= n;
+ }
+ }
+
+ clone->sasl->callbacks= cb;
+ clone->sasl->is_allocated= true;
+
+ return MEMCACHED_SUCCESS;
+}
|
[-]
[+]
|
Added |
libmemcached-0.40.tar.bz2/libmemcached/sasl.h
^
|
@@ -0,0 +1,65 @@
+/* LibMemcached
+ * Copyright (C) 2006-2010 Brian Aker
+ * All rights reserved.
+ *
+ * Use and distribution licensed under the BSD license. See
+ * the COPYING file in the parent directory for full text.
+ *
+ * Summary: interface for memcached server
+ * Description: main include file for libmemcached
+ *
+ */
+#ifndef LIBMEMCACHED_MEMCACHED_SASL_H
+#define LIBMEMCACHED_MEMCACHED_SASL_H
+
+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+#include <sasl/sasl.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+LIBMEMCACHED_API
+void memcached_set_sasl_callbacks(memcached_st *ptr,
+ const sasl_callback_t *callbacks);
+
+LIBMEMCACHED_API
+memcached_return_t memcached_set_sasl_auth_data(memcached_st *ptr,
+ const char *username,
+ const char *password);
+
+LIBMEMCACHED_API
+memcached_return_t memcached_destroy_sasl_auth_data(memcached_st *ptr);
+
+
+LIBMEMCACHED_API
+const sasl_callback_t *memcached_get_sasl_callbacks(memcached_st *ptr);
+
+LIBMEMCACHED_LOCAL
+memcached_return_t memcached_clone_sasl(memcached_st *clone, const memcached_st *source);
+
+LIBMEMCACHED_LOCAL
+memcached_return_t memcached_sasl_authenticate_connection(memcached_server_st *server);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LIBMEMCACHED_WITH_SASL_SUPPORT */
+
+struct memcached_sasl_st {
+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+ const sasl_callback_t *callbacks;
+#else
+ const void *callbacks;
+#endif
+ /*
+ ** Did we allocate data inside the callbacks, or did the user
+ ** supply that.
+ */
+ bool is_allocated;
+};
+
+
+
+#endif /* LIBMEMCACHED_MEMCACHED_SASL_H */
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/server.c
^
|
@@ -29,6 +29,9 @@
self->server_failure_counter= 0;
self->weight= weight;
self->state.is_corked= false;
+ self->state.is_dead= false;
+ WATCHPOINT_SET(self->io_wait_count.read= 0);
+ WATCHPOINT_SET(self->io_wait_count.write= 0);
self->major_version= 0;
self->micro_version= 0;
self->minor_version= 0;
@@ -78,7 +81,8 @@
return self;
}
-memcached_server_st *memcached_server_create_with(const memcached_st *memc, memcached_server_st *self,
+memcached_server_st *memcached_server_create_with(const memcached_st *memc,
+ memcached_server_write_instance_st self,
const char *hostname, in_port_t port,
uint32_t weight, memcached_connection_t type)
{
@@ -144,24 +148,21 @@
}
-memcached_return_t memcached_server_cursor(memcached_st *ptr,
- memcached_server_fn *callback,
+memcached_return_t memcached_server_cursor(const memcached_st *ptr,
+ const memcached_server_fn *callback,
void *context,
uint32_t number_of_callbacks)
{
- uint32_t y;
-
- for (y= 0; y < memcached_server_count(ptr); y++)
+ for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
- uint32_t x;
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(ptr, y);
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(ptr, x);
- for (x= 0; x < number_of_callbacks; x++)
+ for (uint32_t y= 0; y < number_of_callbacks; y++)
{
unsigned int iferror;
- iferror= (*callback[x])(ptr, instance, context);
+ iferror= (*callback[y])(ptr, instance, context);
if (iferror)
continue;
@@ -171,10 +172,13 @@
return MEMCACHED_SUCCESS;
}
-memcached_server_st *memcached_server_by_key(memcached_st *ptr, const char *key, size_t key_length, memcached_return_t *error)
+memcached_server_instance_st memcached_server_by_key(const memcached_st *ptr,
+ const char *key,
+ size_t key_length,
+ memcached_return_t *error)
{
uint32_t server_key;
- memcached_server_instance_st *instance;
+ memcached_server_instance_st instance;
*error= memcached_validate_key_length(key_length,
ptr->flags.binary_protocol);
@@ -194,17 +198,10 @@
}
server_key= memcached_generate_hash(ptr, key, key_length);
- instance= memcached_server_instance_fetch(ptr, server_key);
-
- return memcached_server_clone(NULL, instance);
+ instance= memcached_server_instance_by_position(ptr, server_key);
-}
+ return instance;
-const char *memcached_server_error(memcached_server_st *ptr)
-{
- return ptr
- ? ptr->cached_server_error
- : NULL;
}
void memcached_server_error_reset(memcached_server_st *ptr)
@@ -212,54 +209,66 @@
ptr->cached_server_error[0]= 0;
}
-memcached_server_st *memcached_server_get_last_disconnect(memcached_st *ptr)
+memcached_server_instance_st memcached_server_get_last_disconnect(const memcached_st *ptr)
{
return ptr->last_disconnected_server;
}
-uint32_t memcached_server_list_count(memcached_server_st *ptr)
-{
- return (ptr == NULL)
- ? 0
- : memcached_servers_count(ptr);
-}
-
-void memcached_server_list_free(memcached_server_st *ptr)
-{
- server_list_free(NULL, ptr);
-}
-
-/**
- @todo allow lists to query themselves even if they lack a root
-*/
-memcached_return_t memcached_server_remove(memcached_server_st *st_ptr)
+void memcached_server_list_free(memcached_server_list_st self)
{
- uint32_t x, host_index;
- memcached_st *root= (memcached_st *)st_ptr->root;
- memcached_server_st *list;
-
- if (root == NULL)
- return MEMCACHED_FAILURE;
+ if (self == NULL)
+ return;
- list= memcached_server_list(root);
+ const memcached_st *root= self->root;
- for (x= 0, host_index= 0; x < memcached_server_count(root); x++)
+ for (uint32_t x= 0; x < memcached_server_list_count(self); x++)
{
- if (strncmp(list[x].hostname, st_ptr->hostname, NI_MAXHOST) != 0 || list[x].port != st_ptr->port)
+ if (self[x].address_info)
{
- if (host_index != x)
- memcpy(list+host_index, list+x, sizeof(memcached_server_st));
- host_index++;
+ freeaddrinfo(self[x].address_info);
+ self[x].address_info= NULL;
}
}
- root->number_of_hosts= host_index;
- if (st_ptr->address_info)
+ if (root)
{
- freeaddrinfo(st_ptr->address_info);
- st_ptr->address_info= NULL;
+ libmemcached_free(root, self);
}
- run_distribution(root);
+ else
+ {
+ free(self);
+ }
+}
- return MEMCACHED_SUCCESS;
+uint32_t memcached_servers_set_count(memcached_server_st *servers, uint32_t count)
+{
+ return servers->number_of_hosts= count;
+}
+
+uint32_t memcached_server_count(const memcached_st *self)
+{
+ return self->number_of_hosts;
+}
+
+const char *memcached_server_name(memcached_server_instance_st self)
+{
+ return self->hostname;
+}
+
+in_port_t memcached_server_port(memcached_server_instance_st self)
+{
+ return self->port;
+}
+
+uint32_t memcached_server_response_count(memcached_server_instance_st self)
+{
+ return self->cursor_active;
+}
+
+const char *memcached_server_error(memcached_server_instance_st ptr)
+{
+ return ptr
+ ? ptr->cached_server_error
+ : NULL;
}
+
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/server.h
^
|
@@ -15,10 +15,10 @@
struct memcached_server_st {
struct {
- bool is_allocated MEMCACHED_BITFIELD;
- bool is_initialized MEMCACHED_BITFIELD;
- bool sockaddr_inited MEMCACHED_BITFIELD;
- bool is_shutting_down MEMCACHED_BITFIELD;
+ bool is_allocated:1;
+ bool is_initialized:1;
+ bool sockaddr_inited:1;
+ bool is_shutting_down:1;
} options;
uint32_t number_of_hosts;
uint32_t cursor_active;
@@ -29,8 +29,13 @@
uint32_t server_failure_counter;
uint32_t weight;
struct { // Place any "state" sort variables in here.
- bool is_corked;
+ bool is_corked:1;
+ bool is_dead:1;
} state;
+ struct {
+ uint32_t read;
+ uint32_t write;
+ } io_wait_count;
uint8_t major_version;
uint8_t micro_version;
uint8_t minor_version;
@@ -55,35 +60,20 @@
#endif
LIBMEMCACHED_API
-memcached_return_t memcached_server_cursor(memcached_st *ptr,
- memcached_server_fn *callback,
+memcached_return_t memcached_server_cursor(const memcached_st *ptr,
+ const memcached_server_fn *callback,
void *context,
uint32_t number_of_callbacks);
LIBMEMCACHED_API
-memcached_server_st *memcached_server_by_key(memcached_st *ptr,
- const char *key,
- size_t key_length,
- memcached_return_t *error);
-
-LIBMEMCACHED_API
-const char *memcached_server_error(memcached_server_st *ptr);
+ memcached_server_instance_st memcached_server_by_key(const memcached_st *ptr,
+ const char *key,
+ size_t key_length,
+ memcached_return_t *error);
LIBMEMCACHED_API
void memcached_server_error_reset(memcached_server_st *ptr);
-/* These should not currently be used by end users */
-/* TODO: Is the above comment valid? If so, how can we unit test these if they
- * aren't exported. If not, we should remove the comment */
-
-LIBMEMCACHED_LOCAL
-memcached_server_st *memcached_server_create_with(const memcached_st *memc,
- memcached_server_st *host,
- const char *hostname,
- in_port_t port,
- uint32_t weight,
- memcached_connection_t type);
-
LIBMEMCACHED_API
void memcached_server_free(memcached_server_st *ptr);
@@ -92,10 +82,7 @@
const memcached_server_st *source);
LIBMEMCACHED_API
-memcached_return_t memcached_server_remove(memcached_server_st *st_ptr);
-
-LIBMEMCACHED_API
-memcached_server_st *memcached_server_get_last_disconnect(memcached_st *ptr);
+memcached_server_instance_st memcached_server_get_last_disconnect(const memcached_st *ptr);
LIBMEMCACHED_API
@@ -122,48 +109,23 @@
memcached_return_t memcached_server_add_with_weight(memcached_st *ptr, const char *hostname,
in_port_t port,
uint32_t weight);
-/* Server List Public functions */
+/**
+ Operations on Single Servers.
+*/
LIBMEMCACHED_API
-void memcached_server_list_free(memcached_server_st *ptr);
-
+uint32_t memcached_server_response_count(memcached_server_instance_st self);
LIBMEMCACHED_API
-memcached_return_t memcached_server_push(memcached_st *ptr, memcached_server_st *list);
+const char *memcached_server_name(memcached_server_instance_st self);
LIBMEMCACHED_API
-memcached_server_st *memcached_server_list_append(memcached_server_st *ptr,
- const char *hostname,
- in_port_t port,
- memcached_return_t *error);
-LIBMEMCACHED_API
-memcached_server_st *memcached_server_list_append_with_weight(memcached_server_st *ptr,
- const char *hostname,
- in_port_t port,
- uint32_t weight,
- memcached_return_t *error);
-LIBMEMCACHED_API
-unsigned int memcached_server_list_count(memcached_server_st *ptr);
-
-// Local Only Inline
-static inline uint32_t memcached_servers_count(memcached_server_st *servers)
-{
- return servers->number_of_hosts;
-}
+in_port_t memcached_server_port(memcached_server_instance_st self);
-// Local Only Inline
-static inline uint32_t memcached_servers_set_count(memcached_server_st *servers, uint32_t count)
-{
- return servers->number_of_hosts= count;
-}
+LIBMEMCACHED_API
+const char *memcached_server_error(memcached_server_instance_st ptr);
-#define memcached_server_count(A) (A)->number_of_hosts
-#define memcached_server_name(A,B) (B).hostname
-#define memcached_server_port(A,B) (B).port
-#define memcached_server_list(A) (A)->servers
-#define memcached_server_list_set(A,B) (A)->servers=(B)
-#define memcached_server_response_count(A) (A)->cursor_active
#ifdef __cplusplus
} // extern "C"
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/server_list.c
^
|
@@ -12,13 +12,14 @@
#include "common.h"
-memcached_server_st *memcached_server_list_append_with_weight(memcached_server_st *ptr,
- const char *hostname, in_port_t port,
- uint32_t weight,
- memcached_return_t *error)
+memcached_server_list_st
+memcached_server_list_append_with_weight(memcached_server_list_st ptr,
+ const char *hostname, in_port_t port,
+ uint32_t weight,
+ memcached_return_t *error)
{
- unsigned int count;
- memcached_server_instance_st *new_host_list;
+ uint32_t count;
+ memcached_server_list_st new_host_list;
if (hostname == NULL || error == NULL)
return NULL;
@@ -30,10 +31,10 @@
count= 1;
if (ptr != NULL)
{
- count+= memcached_servers_count(ptr);
+ count+= memcached_server_list_count(ptr);
}
- new_host_list= (memcached_server_instance_st *)realloc(ptr, sizeof(memcached_server_instance_st) * count);
+ new_host_list= (memcached_server_write_instance_st)realloc(ptr, sizeof(memcached_server_st) * count);
if (!new_host_list)
{
*error= MEMCACHED_MEMORY_ALLOCATION_FAILURE;
@@ -50,9 +51,27 @@
return new_host_list;
}
-memcached_server_st *memcached_server_list_append(memcached_server_st *ptr,
- const char *hostname, in_port_t port,
- memcached_return_t *error)
+memcached_server_list_st
+memcached_server_list_append(memcached_server_list_st ptr,
+ const char *hostname, in_port_t port,
+ memcached_return_t *error)
{
return memcached_server_list_append_with_weight(ptr, hostname, port, 0, error);
}
+
+uint32_t memcached_server_list_count(const memcached_server_list_st self)
+{
+ return (self == NULL)
+ ? 0
+ : self->number_of_hosts;
+}
+
+memcached_server_st *memcached_server_list(const memcached_st *self)
+{
+ return self->servers;
+}
+
+void memcached_server_list_set(memcached_st *self, memcached_server_st *list)
+{
+ self->servers= list;
+}
|
[-]
[+]
|
Added |
libmemcached-0.40.tar.bz2/libmemcached/server_list.h
^
|
@@ -0,0 +1,53 @@
+/* LibMemcached
+ * Copyright (C) 2006-2009 Brian Aker
+ * All rights reserved.
+ *
+ * Use and distribution licensed under the BSD license. See
+ * the COPYING file in the parent directory for full text.
+ *
+ * Summary: Types for libmemcached
+ *
+ */
+
+#ifndef __LIBMEMCACHED_SERVER_LIST_H__
+#define __LIBMEMCACHED_SERVER_LIST_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Server List Public functions */
+LIBMEMCACHED_API
+ void memcached_server_list_free(memcached_server_list_st ptr);
+
+LIBMEMCACHED_API
+ memcached_return_t memcached_server_push(memcached_st *ptr, const memcached_server_list_st list);
+
+LIBMEMCACHED_API
+ memcached_server_list_st memcached_server_list_append(memcached_server_list_st ptr,
+ const char *hostname,
+ in_port_t port,
+ memcached_return_t *error);
+LIBMEMCACHED_API
+ memcached_server_list_st memcached_server_list_append_with_weight(memcached_server_list_st ptr,
+ const char *hostname,
+ in_port_t port,
+ uint32_t weight,
+ memcached_return_t *error);
+LIBMEMCACHED_API
+ uint32_t memcached_server_list_count(const memcached_server_list_st ptr);
+
+LIBMEMCACHED_LOCAL
+ uint32_t memcached_servers_set_count(memcached_server_list_st servers, uint32_t count);
+
+LIBMEMCACHED_LOCAL
+ memcached_server_st *memcached_server_list(const memcached_st *);
+
+LIBMEMCACHED_LOCAL
+ void memcached_server_list_set(memcached_st *self, memcached_server_list_st list);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* __LIBMEMCACHED_SERVER_LIST_H__ */
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/stats.c
^
|
@@ -161,7 +161,7 @@
return MEMCACHED_SUCCESS;
}
-char *memcached_stat_get_value(memcached_st *ptr, memcached_stat_st *memc_stat,
+char *memcached_stat_get_value(const memcached_st *ptr, memcached_stat_st *memc_stat,
const char *key, memcached_return_t *error)
{
char buffer[SMALL_STRING_LEN];
@@ -229,7 +229,7 @@
static memcached_return_t binary_stats_fetch(memcached_stat_st *memc_stat,
char *args,
- memcached_server_instance_st *instance)
+ memcached_server_write_instance_st instance)
{
memcached_return_t rc;
@@ -250,9 +250,13 @@
request.message.header.request.keylen= htons((uint16_t)len);
request.message.header.request.bodylen= htonl((uint32_t) len);
- if ((memcached_do(instance, request.bytes,
- sizeof(request.bytes), false) != MEMCACHED_SUCCESS) ||
- (memcached_io_write(instance, args, len, true) == -1))
+ struct __write_vector_st vector[]=
+ {
+ { .length= sizeof(request.bytes), .buffer= request.bytes },
+ { .length= len, .buffer= args }
+ };
+
+ if (memcached_vdo(instance, vector, 2, true) != MEMCACHED_SUCCESS)
{
memcached_io_reset(instance);
return MEMCACHED_WRITE_FAILURE;
@@ -271,8 +275,8 @@
memcached_server_response_decrement(instance);
do
{
- rc= memcached_response(instance, buffer,
- sizeof(buffer), NULL);
+ rc= memcached_response(instance, buffer, sizeof(buffer), NULL);
+
if (rc == MEMCACHED_END)
break;
@@ -299,7 +303,7 @@
static memcached_return_t ascii_stats_fetch(memcached_stat_st *memc_stat,
char *args,
- memcached_server_instance_st *instance)
+ memcached_server_write_instance_st instance)
{
memcached_return_t rc;
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
@@ -379,7 +383,7 @@
for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
memcached_return_t temp_return;
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
memcached_stat_st *stat_instance;
stat_instance= stats + x;
@@ -411,7 +415,9 @@
memcached_return_t rc;
memcached_st memc;
memcached_st *memc_ptr;
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
+
+ memset(memc_stat, 0, sizeof(memcached_stat_st));
memc_ptr= memcached_create(&memc);
WATCHPOINT_ASSERT(memc_ptr);
@@ -438,7 +444,7 @@
We make a copy of the keys since at some point in the not so distant future
we will add support for "found" keys.
*/
-char ** memcached_stat_get_keys(memcached_st *ptr,
+char ** memcached_stat_get_keys(const memcached_st *ptr,
memcached_stat_st *memc_stat,
memcached_return_t *error)
{
@@ -462,7 +468,7 @@
return list;
}
-void memcached_stat_free(memcached_st *ptr, memcached_stat_st *memc_stat)
+void memcached_stat_free(const memcached_st *ptr, memcached_stat_st *memc_stat)
{
if (memc_stat == NULL)
{
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/stats.h
^
|
@@ -45,7 +45,7 @@
#endif
LIBMEMCACHED_API
-void memcached_stat_free(memcached_st *, memcached_stat_st *);
+void memcached_stat_free(const memcached_st *, memcached_stat_st *);
LIBMEMCACHED_API
memcached_stat_st *memcached_stat(memcached_st *ptr, char *args, memcached_return_t *error);
@@ -55,11 +55,11 @@
const char *hostname, in_port_t port);
LIBMEMCACHED_API
-char *memcached_stat_get_value(memcached_st *ptr, memcached_stat_st *memc_stat,
+char *memcached_stat_get_value(const memcached_st *ptr, memcached_stat_st *memc_stat,
const char *key, memcached_return_t *error);
LIBMEMCACHED_API
-char ** memcached_stat_get_keys(memcached_st *ptr, memcached_stat_st *memc_stat,
+char ** memcached_stat_get_keys(const memcached_st *ptr, memcached_stat_st *memc_stat,
memcached_return_t *error);
#ifdef __cplusplus
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/storage.c
^
|
@@ -45,8 +45,8 @@
}
static memcached_return_t memcached_send_binary(memcached_st *ptr,
- const char *master_key,
- size_t master_key_length,
+ memcached_server_write_instance_st server,
+ uint32_t server_key,
const char *key,
size_t key_length,
const char *value,
@@ -70,7 +70,7 @@
memcached_return_t rc;
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
uint32_t server_key;
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
WATCHPOINT_ASSERT(!(value == NULL && value_length > 0));
@@ -84,112 +84,122 @@
if (ptr->flags.verify_key && (memcached_key_test((const char **)&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED))
return MEMCACHED_BAD_KEY_PROVIDED;
- if (ptr->flags.binary_protocol)
- {
- return memcached_send_binary(ptr, master_key, master_key_length,
- key, key_length,
- value, value_length, expiration,
- flags, cas, verb);
- }
-
- server_key= memcached_generate_hash(ptr, master_key, master_key_length);
+ server_key= memcached_generate_hash_with_redistribution(ptr, master_key, master_key_length);
instance= memcached_server_instance_fetch(ptr, server_key);
- if (cas)
+ WATCHPOINT_SET(instance->io_wait_count.read= 0);
+ WATCHPOINT_SET(instance->io_wait_count.write= 0);
+
+ if (ptr->flags.binary_protocol)
{
- write_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
- "%s %.*s%.*s %u %llu %zu %llu%s\r\n",
- storage_op_string(verb),
- (int)ptr->prefix_key_length,
- ptr->prefix_key,
- (int)key_length, key, flags,
- (unsigned long long)expiration, value_length,
- (unsigned long long)cas,
- (ptr->flags.no_reply) ? " noreply" : "");
+ rc= memcached_send_binary(ptr, instance, server_key,
+ key, key_length,
+ value, value_length, expiration,
+ flags, cas, verb);
+ WATCHPOINT_IF_LABELED_NUMBER(instance->io_wait_count.read > 2, "read IO_WAIT", instance->io_wait_count.read);
+ WATCHPOINT_IF_LABELED_NUMBER(instance->io_wait_count.write > 2, "write_IO_WAIT", instance->io_wait_count.write);
}
else
{
- char *buffer_ptr= buffer;
- const char *command= storage_op_string(verb);
- /* Copy in the command, no space needed, we handle that in the command function*/
- memcpy(buffer_ptr, command, strlen(command));
-
- /* Copy in the key prefix, switch to the buffer_ptr */
- buffer_ptr= memcpy((buffer_ptr + strlen(command)), ptr->prefix_key, ptr->prefix_key_length);
-
- /* Copy in the key, adjust point if a key prefix was used. */
- buffer_ptr= memcpy(buffer_ptr + (ptr->prefix_key_length ? ptr->prefix_key_length : 0),
- key, key_length);
- buffer_ptr+= key_length;
- buffer_ptr[0]= ' ';
- buffer_ptr++;
-
- write_length= (size_t)(buffer_ptr - buffer);
- write_length+= (size_t) snprintf(buffer_ptr, MEMCACHED_DEFAULT_COMMAND_SIZE,
- "%u %llu %zu%s\r\n",
- flags,
- (unsigned long long)expiration, value_length,
- ptr->flags.no_reply ? " noreply" : "");
- }
-
- if (ptr->flags.use_udp && ptr->flags.buffer_requests)
- {
- size_t cmd_size= write_length + value_length + 2;
- if (cmd_size > MAX_UDP_DATAGRAM_LENGTH - UDP_DATAGRAM_HEADER_LENGTH)
- return MEMCACHED_WRITE_FAILURE;
- if (cmd_size + instance->write_buffer_offset > MAX_UDP_DATAGRAM_LENGTH)
- memcached_io_write(instance, NULL, 0, true);
- }
+ if (cas)
+ {
+ write_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
+ "%s %.*s%.*s %u %llu %zu %llu%s\r\n",
+ storage_op_string(verb),
+ (int)ptr->prefix_key_length,
+ ptr->prefix_key,
+ (int)key_length, key, flags,
+ (unsigned long long)expiration, value_length,
+ (unsigned long long)cas,
+ (ptr->flags.no_reply) ? " noreply" : "");
+ }
+ else
+ {
+ char *buffer_ptr= buffer;
+ const char *command= storage_op_string(verb);
- if (write_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
- {
- rc= MEMCACHED_WRITE_FAILURE;
- goto error;
- }
+ /* Copy in the command, no space needed, we handle that in the command function*/
+ memcpy(buffer_ptr, command, strlen(command));
- /* Send command header */
- rc= memcached_do(instance, buffer, write_length, false);
- if (rc != MEMCACHED_SUCCESS)
- goto error;
+ /* Copy in the key prefix, switch to the buffer_ptr */
+ buffer_ptr= memcpy((buffer_ptr + strlen(command)), ptr->prefix_key, ptr->prefix_key_length);
- /* Send command body */
- if (memcached_io_write(instance, value, value_length, false) == -1)
- {
- rc= MEMCACHED_WRITE_FAILURE;
- goto error;
- }
+ /* Copy in the key, adjust point if a key prefix was used. */
+ buffer_ptr= memcpy(buffer_ptr + (ptr->prefix_key_length ? ptr->prefix_key_length : 0),
+ key, key_length);
+ buffer_ptr+= key_length;
+ buffer_ptr[0]= ' ';
+ buffer_ptr++;
+
+ write_length= (size_t)(buffer_ptr - buffer);
+ write_length+= (size_t) snprintf(buffer_ptr, MEMCACHED_DEFAULT_COMMAND_SIZE,
+ "%u %llu %zu%s\r\n",
+ flags,
+ (unsigned long long)expiration, value_length,
+ ptr->flags.no_reply ? " noreply" : "");
+ }
- if (ptr->flags.buffer_requests && verb == SET_OP)
- {
- to_write= false;
- }
- else
- {
- to_write= true;
- }
+ if (ptr->flags.use_udp && ptr->flags.buffer_requests)
+ {
+ size_t cmd_size= write_length + value_length + 2;
+ if (cmd_size > MAX_UDP_DATAGRAM_LENGTH - UDP_DATAGRAM_HEADER_LENGTH)
+ return MEMCACHED_WRITE_FAILURE;
+ if (cmd_size + instance->write_buffer_offset > MAX_UDP_DATAGRAM_LENGTH)
+ memcached_io_write(instance, NULL, 0, true);
+ }
- if (memcached_io_write(instance, "\r\n", 2, to_write) == -1)
- {
- rc= MEMCACHED_WRITE_FAILURE;
- goto error;
- }
+ if (write_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
+ {
+ rc= MEMCACHED_WRITE_FAILURE;
+ }
+ else
+ {
+ struct __write_vector_st vector[]=
+ {
+ { .length= write_length, .buffer= buffer },
+ { .length= value_length, .buffer= value },
+ { .length= 2, .buffer= "\r\n" }
+ };
- if (ptr->flags.no_reply)
- return (to_write == false) ? MEMCACHED_BUFFERED : MEMCACHED_SUCCESS;
+ if (ptr->flags.buffer_requests && verb == SET_OP)
+ {
+ to_write= false;
+ }
+ else
+ {
+ to_write= true;
+ }
- if (to_write == false)
- return MEMCACHED_BUFFERED;
+ /* Send command header */
+ rc= memcached_vdo(instance, vector, 3, to_write);
+ if (rc == MEMCACHED_SUCCESS)
+ {
- rc= memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
+ if (ptr->flags.no_reply)
+ {
+ rc= (to_write == false) ? MEMCACHED_BUFFERED : MEMCACHED_SUCCESS;
+ }
+ else if (to_write == false)
+ {
+ rc= MEMCACHED_BUFFERED;
+ }
+ else
+ {
+ rc= memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
+
+ if (rc == MEMCACHED_STORED)
+ rc= MEMCACHED_SUCCESS;
+ }
+ }
+ }
- if (rc == MEMCACHED_STORED)
- return MEMCACHED_SUCCESS;
- else
- return rc;
+ if (rc == MEMCACHED_WRITE_FAILURE)
+ memcached_io_reset(instance);
+ }
-error:
- memcached_io_reset(instance);
+ WATCHPOINT_IF_LABELED_NUMBER(instance->io_wait_count.read > 2, "read IO_WAIT", instance->io_wait_count.read);
+ WATCHPOINT_IF_LABELED_NUMBER(instance->io_wait_count.write > 2, "write_IO_WAIT", instance->io_wait_count.write);
return rc;
}
@@ -430,8 +440,8 @@
static memcached_return_t memcached_send_binary(memcached_st *ptr,
- const char *master_key,
- size_t master_key_length,
+ memcached_server_write_instance_st server,
+ uint32_t server_key,
const char *key,
size_t key_length,
const char *value,
@@ -444,17 +454,12 @@
bool flush;
protocol_binary_request_set request= {.bytes= {0}};
size_t send_length= sizeof(request.bytes);
- uint32_t server_key= memcached_generate_hash(ptr, master_key,
- master_key_length);
-
- memcached_server_instance_st *server=
- memcached_server_instance_fetch(ptr, server_key);
bool noreply= server->root->flags.no_reply;
request.message.header.request.magic= PROTOCOL_BINARY_REQ;
request.message.header.request.opcode= get_com_code(verb, noreply);
- request.message.header.request.keylen= htons((uint16_t)key_length);
+ request.message.header.request.keylen= htons((uint16_t)(key_length + ptr->prefix_key_length));
request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
if (verb == APPEND_OP || verb == PREPEND_OP)
send_length -= 8; /* append & prepend does not contain extras! */
@@ -465,7 +470,7 @@
request.message.body.expiration= htonl((uint32_t)expiration);
}
- request.message.header.request.bodylen= htonl((uint32_t) (key_length + value_length +
+ request.message.header.request.bodylen= htonl((uint32_t) (key_length + ptr->prefix_key_length + value_length +
request.message.header.request.extlen));
if (cas)
@@ -487,22 +492,30 @@
}
}
+ struct __write_vector_st vector[]=
+ {
+ { .length= send_length, .buffer= request.bytes },
+ { .length= ptr->prefix_key_length, .buffer= ptr->prefix_key },
+ { .length= key_length, .buffer= key },
+ { .length= value_length, .buffer= value }
+ };
+
/* write the header */
- if ((memcached_do(server, (const char*)request.bytes, send_length, false) != MEMCACHED_SUCCESS) ||
- (memcached_io_write(server, key, key_length, false) == -1) ||
- (memcached_io_write(server, value, value_length, flush) == -1))
+ memcached_return_t rc;
+ if ((rc= memcached_vdo(server, vector, 4, flush)) != MEMCACHED_SUCCESS)
{
memcached_io_reset(server);
- return MEMCACHED_WRITE_FAILURE;
+ return (rc == MEMCACHED_SUCCESS) ? MEMCACHED_WRITE_FAILURE : rc;
}
- unlikely (verb == SET_OP && ptr->number_of_replicas > 0)
+ if (verb == SET_OP && ptr->number_of_replicas > 0)
{
request.message.header.request.opcode= PROTOCOL_BINARY_CMD_SETQ;
+ WATCHPOINT_STRING("replicating");
for (uint32_t x= 0; x < ptr->number_of_replicas; x++)
{
- memcached_server_instance_st *instance;
+ memcached_server_write_instance_st instance;
++server_key;
if (server_key == memcached_server_count(ptr))
@@ -510,10 +523,7 @@
instance= memcached_server_instance_fetch(ptr, server_key);
- if ((memcached_do(instance, (const char*)request.bytes,
- send_length, false) != MEMCACHED_SUCCESS) ||
- (memcached_io_write(instance, key, key_length, false) == -1) ||
- (memcached_io_write(instance, value, value_length, flush) == -1))
+ if (memcached_vdo(instance, vector, 4, false) != MEMCACHED_SUCCESS)
{
memcached_io_reset(instance);
}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/strerror.c
^
|
@@ -84,6 +84,12 @@
return "INVALID ARGUMENTS";
case MEMCACHED_KEY_TOO_BIG:
return "KEY RETURNED FROM SERVER WAS TOO LARGE";
+ case MEMCACHED_AUTH_PROBLEM:
+ return "FAILED TO SEND AUTHENTICATION TO SERVER";
+ case MEMCACHED_AUTH_FAILURE:
+ return "AUTHENTICATION FAILURE";
+ case MEMCACHED_AUTH_CONTINUE:
+ return "CONTINUE AUTHENTICATION";
case MEMCACHED_MAXIMUM_RETURN:
return "Gibberish returned!";
default:
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/string.c
^
|
@@ -177,3 +177,27 @@
return _string_check(string, need);
}
+size_t memcached_string_length(const memcached_string_st *self)
+{
+ return (size_t)(self->end - self->string);
+}
+
+size_t memcached_string_size(const memcached_string_st *self)
+{
+ return self->current_size;
+}
+
+const char *memcached_string_value(const memcached_string_st *self)
+{
+ return self->string;
+}
+
+char *memcached_string_value_mutable(const memcached_string_st *self)
+{
+ return self->string;
+}
+
+void memcached_string_set_length(memcached_string_st *self, size_t length)
+{
+ self->end= self->string + length;
+}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/string.h
^
|
@@ -28,8 +28,8 @@
size_t current_size;
const memcached_st *root;
struct {
- bool is_allocated MEMCACHED_BITFIELD;
- bool is_initialized MEMCACHED_BITFIELD;
+ bool is_allocated:1;
+ bool is_initialized:1;
} options;
};
@@ -59,27 +59,20 @@
LIBMEMCACHED_LOCAL
void memcached_string_free(memcached_string_st *string);
-static inline size_t memcached_string_length(const memcached_string_st *self)
-{
- return (size_t)(self->end - self->string);
-}
+LIBMEMCACHED_LOCAL
+size_t memcached_string_length(const memcached_string_st *self);
-static inline size_t memcached_string_size(const memcached_string_st *self)
-{
- return self->current_size;
-}
+LIBMEMCACHED_LOCAL
+size_t memcached_string_size(const memcached_string_st *self);
-static inline const char *memcached_string_value(const memcached_string_st *self)
-{
- return self->string;
-}
+LIBMEMCACHED_LOCAL
+const char *memcached_string_value(const memcached_string_st *self);
-static inline char *memcached_string_value_mutable(const memcached_string_st *self)
-{
- return self->string;
-}
+LIBMEMCACHED_LOCAL
+char *memcached_string_value_mutable(const memcached_string_st *self);
-#define memcached_string_set_length(A, B) (A)->end= (A)->string + B
+LIBMEMCACHED_LOCAL
+void memcached_string_set_length(memcached_string_st *self, size_t length);
#ifdef __cplusplus
}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/types.h
^
|
@@ -16,9 +16,15 @@
typedef struct memcached_stat_st memcached_stat_st;
typedef struct memcached_analysis_st memcached_analysis_st;
typedef struct memcached_result_st memcached_result_st;
+
+// All of the flavors of memcache_server_st
typedef struct memcached_server_st memcached_server_st;
+typedef const struct memcached_server_st *memcached_server_instance_st;
+typedef struct memcached_server_st *memcached_server_list_st;
+
typedef struct memcached_callback_st memcached_callback_st;
+// The following two structures are internal, and never exposed to users.
typedef struct memcached_string_st memcached_string_st;
typedef struct memcached_continuum_item_st memcached_continuum_item_st;
@@ -40,7 +46,7 @@
typedef memcached_return_t (*memcached_execute_fn)(const memcached_st *ptr, memcached_result_st *result, void *context);
-typedef memcached_return_t (*memcached_server_fn)(const memcached_st *ptr, memcached_server_st *server, void *context);
+typedef memcached_return_t (*memcached_server_fn)(const memcached_st *ptr, memcached_server_instance_st server, void *context);
/**
Trigger functions.
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/verbosity.c
^
|
@@ -1,38 +1,59 @@
#include "common.h"
-memcached_return_t memcached_verbosity(memcached_st *ptr, uint32_t verbosity)
+struct context_st
+{
+ size_t length;
+ const char *buffer;
+};
+
+static memcached_return_t _set_verbosity(const memcached_st *ptr __attribute__((unused)),
+ const memcached_server_st *server,
+ void *context)
{
- uint32_t x;
- size_t send_length;
memcached_return_t rc;
+ memcached_st local_memc;
+ memcached_st *memc_ptr;
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
- send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
- "verbosity %u\r\n", verbosity);
- unlikely (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
- return MEMCACHED_WRITE_FAILURE;
+ struct context_st *execute= (struct context_st *)context;
- rc= MEMCACHED_SUCCESS;
- for (x= 0; x < memcached_server_count(ptr); x++)
+ memc_ptr= memcached_create(&local_memc);
+
+ rc= memcached_server_add(memc_ptr, memcached_server_name(server), memcached_server_port(server));
+
+ if (rc == MEMCACHED_SUCCESS)
{
- memcached_return_t rrc;
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(ptr, x);
+ memcached_server_write_instance_st instance=
+ memcached_server_instance_fetch(memc_ptr, 0);
- rrc= memcached_do(instance, buffer, send_length, true);
- if (rrc != MEMCACHED_SUCCESS)
+ rc= memcached_do(instance, execute->buffer, execute->length, true);
+
+ if (rc == MEMCACHED_SUCCESS)
{
- rc= MEMCACHED_SOME_ERRORS;
- continue;
+ rc= memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
}
-
- unlikely (ptr->flags.use_udp)
- continue;
-
- rrc= memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
- if (rrc != MEMCACHED_SUCCESS)
- rc= MEMCACHED_SOME_ERRORS;
}
+ memcached_free(memc_ptr);
+
return rc;
}
+
+memcached_return_t memcached_verbosity(memcached_st *ptr, uint32_t verbosity)
+{
+ size_t send_length;
+ memcached_server_fn callbacks[1];
+
+ char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
+
+ send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
+ "verbosity %u\r\n", verbosity);
+ unlikely (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
+ return MEMCACHED_WRITE_FAILURE;
+
+ struct context_st context = { .length= send_length, .buffer= buffer };
+
+ callbacks[0]= _set_verbosity;
+
+ return memcached_server_cursor(ptr, callbacks, &context, 1);
+}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/version.c
^
|
@@ -33,7 +33,7 @@
for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
memcached_return_t rrc;
- memcached_server_instance_st *instance=
+ memcached_server_write_instance_st instance=
memcached_server_instance_fetch(ptr, x);
rrc= memcached_do(instance, command, send_length, true);
@@ -69,18 +69,17 @@
static inline memcached_return_t memcached_version_binary(memcached_st *ptr)
{
memcached_return_t rc;
- unsigned int x;
protocol_binary_request_version request= { .bytes= {0}};
request.message.header.request.magic= PROTOCOL_BINARY_REQ;
request.message.header.request.opcode= PROTOCOL_BINARY_CMD_VERSION;
request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
rc= MEMCACHED_SUCCESS;
- for (x= 0; x < memcached_server_count(ptr); x++)
+ for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
memcached_return_t rrc;
- memcached_server_instance_st *instance=
+ memcached_server_write_instance_st instance=
memcached_server_instance_fetch(ptr, x);
rrc= memcached_do(instance, request.bytes, sizeof(request.bytes), true);
@@ -92,9 +91,9 @@
}
}
- for (x= 0; x < memcached_server_count(ptr); x++)
+ for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
- memcached_server_instance_st *instance=
+ memcached_server_write_instance_st instance=
memcached_server_instance_fetch(ptr, x);
if (memcached_server_response_count(instance) > 0)
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/libmemcached/watchpoint.h
^
|
@@ -50,6 +50,8 @@
#define WATCHPOINT_STRING(A) do { fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__,A);fflush(stdout); } while (0)
#define WATCHPOINT_STRING_LENGTH(A,B) do { fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %.*s\n", __FILE__, __LINE__,__func__,(int)B,A);fflush(stdout); } while (0)
#define WATCHPOINT_NUMBER(A) do { fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %zu\n", __FILE__, __LINE__,__func__,(size_t)(A));fflush(stdout); } while (0)
+#define WATCHPOINT_LABELED_NUMBER(A,B) do { fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s:%zu\n", __FILE__, __LINE__,__func__,(A),(size_t)(B));fflush(stdout); } while (0)
+#define WATCHPOINT_IF_LABELED_NUMBER(A,B,C) do { if(A) {fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s:%zu\n", __FILE__, __LINE__,__func__,(B),(size_t)(C));fflush(stdout);} } while (0)
#define WATCHPOINT_ERRNO(A) do { fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__, strerror(A));fflush(stdout); } while (0)
#define WATCHPOINT_ASSERT_PRINT(A,B,C) do { if(!(A)){fprintf(stderr, "\nWATCHPOINT ASSERT %s:%d (%s) ", __FILE__, __LINE__,__func__);fprintf(stderr, (B),(C));fprintf(stderr,"\n");fflush(stdout); __stack_dump(); } assert((A)); } while (0)
#define WATCHPOINT_ASSERT(A) do { if (! (A)) {__stack_dump();} assert((A)); } while (0)
@@ -63,6 +65,8 @@
#define WATCHPOINT_IFERROR(A)
#define WATCHPOINT_STRING(A)
#define WATCHPOINT_NUMBER(A)
+#define WATCHPOINT_LABELED_NUMBER(A,B)
+#define WATCHPOINT_IF_LABELED_NUMBER(A,B,C)
#define WATCHPOINT_ERRNO(A)
#define WATCHPOINT_ASSERT_PRINT(A,B,C)
#define WATCHPOINT_ASSERT(A)
|
[-]
[+]
|
Added |
libmemcached-0.40.tar.bz2/m4/pandora_sasl.m4
^
|
@@ -0,0 +1,133 @@
+dnl Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([_PANDORA_SEARCH_SASL],[
+ AC_REQUIRE([AC_LIB_PREFIX])
+
+ dnl --------------------------------------------------------------------
+ dnl Check for sasl
+ dnl --------------------------------------------------------------------
+ AC_ARG_ENABLE([sasl],
+ [AS_HELP_STRING([--disable-sasl],
+ [Build with sasl support @<:@default=on@:>@])],
+ [ac_enable_sasl="$enableval"],
+ [ac_enable_sasl="no"])
+
+ AS_IF([test "x$ac_enable_sasl" = "xyes"],
+ [
+ AC_LIB_HAVE_LINKFLAGS(sasl,,[
+ #include <stdlib.h>
+ #include <sasl/sasl.h>
+ ],[
+ sasl_server_init(NULL, NULL);
+ ])
+
+ AS_IF([test "x${ac_cv_libsasl}" != "xyes" ],
+ [
+ AC_LIB_HAVE_LINKFLAGS(sasl2,,[
+ #include <stdlib.h>
+ #include <sasl/sasl.h>
+ ],[
+ sasl_server_init(NULL, NULL);
+ ])
+ HAVE_LIBSASL="$HAVE_LIBSASL2"
+ LIBSASL="$LIBSASL2"
+ LIBSASL_PREFIX="$LIBSASL2_PREFIX"
+ LTLIBSASL="$LT_LIBSASL2"
+ ])
+ ])
+
+ AS_IF([test "x${ac_cv_libsasl}" = "xyes" -o "x${ac_cv_libsasl2}" = "xyes"],
+ [ac_cv_sasl=yes],
+ [ac_cv_sasl=no])
+
+ AM_CONDITIONAL(HAVE_LIBSASL, [test "x${ac_cv_libsasl}" = "xyes"])
+ AM_CONDITIONAL(HAVE_LIBSASL2, [test "x${ac_cv_libsasl2}" = "xyes"])
+ AM_CONDITIONAL(HAVE_SASL, [test "x${ac_cv_sasl}" = "xyes"])
+])
+
+AC_DEFUN([PANDORA_HAVE_SASL],[
+ AC_REQUIRE([_PANDORA_SEARCH_SASL])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_SASL],[
+ AC_REQUIRE([_PANDORA_SEARCH_SASL])
+ AS_IF([test "x${ac_cv_sasl}" = "xno"],
+ AC_MSG_ERROR([SASL (libsasl or libsasl2) is required for ${PACKAGE}]))
+])
+
+AC_DEFUN([_PANDORA_SEARCH_LIBSASL],[
+ AC_REQUIRE([AC_LIB_PREFIX])
+
+ dnl --------------------------------------------------------------------
+ dnl Check for libsasl
+ dnl --------------------------------------------------------------------
+
+ AC_ARG_ENABLE([libsasl],
+ [AS_HELP_STRING([--disable-libsasl],
+ [Build with libsasl support @<:@default=on@:>@])],
+ [ac_enable_libsasl="$enableval"],
+ [ac_enable_libsasl="yes"])
+
+ AS_IF([test "x$ac_enable_libsasl" = "xyes"],[
+ AC_LIB_HAVE_LINKFLAGS(sasl,,[
+ #include <stdlib.h>
+ #include <sasl/sasl.h>
+ ],[
+ sasl_server_init(NULL, NULL);
+ ])
+ ],[
+ ac_cv_libsasl="no"
+ ])
+
+ AM_CONDITIONAL(HAVE_LIBSASL, [test "x${ac_cv_libsasl}" = "xyes"])
+])
+
+AC_DEFUN([PANDORA_HAVE_LIBSASL],[
+ AC_REQUIRE([_PANDORA_SEARCH_LIBSASL])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBSASL],[
+ AC_REQUIRE([_PANDORA_SEARCH_LIBSASL])
+ AS_IF([test "x${ac_cv_libsasl}" = "xno"],
+ AC_MSG_ERROR([libsasl is required for ${PACKAGE}]))
+])
+
+AC_DEFUN([_PANDORA_SEARCH_LIBSASL2],[
+ AC_REQUIRE([AC_LIB_PREFIX])
+
+ dnl --------------------------------------------------------------------
+ dnl Check for libsasl2
+ dnl --------------------------------------------------------------------
+
+ AC_ARG_ENABLE([libsasl2],
+ [AS_HELP_STRING([--disable-libsasl2],
+ [Build with libsasl2 support @<:@default=on@:>@])],
+ [ac_enable_libsasl2="$enableval"],
+ [ac_enable_libsasl2="yes"])
+
+ AS_IF([test "x$ac_enable_libsasl2" = "xyes"],[
+ AC_LIB_HAVE_LINKFLAGS(sasl2,,[
+ #include <stdlib.h>
+ #include <sasl2/sasl2.h>
+ ],[
+ sasl2_server_init(NULL, NULL);
+ ])
+ ],[
+ ac_cv_libsasl2="no"
+ ])
+
+ AM_CONDITIONAL(HAVE_LIBSASL2, [test "x${ac_cv_libsasl2}" = "xyes"])
+])
+
+AC_DEFUN([PANDORA_HAVE_LIBSASL2],[
+ AC_REQUIRE([_PANDORA_SEARCH_LIBSASL2])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBSASL2],[
+ AC_REQUIRE([_PANDORA_SEARCH_LIBSASL2])
+ AS_IF([test "x${ac_cv_libsasl2}" = "xno"],
+ AC_MSG_ERROR([libsasl2 is required for ${PACKAGE}]))
+])
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/m4/protocol_binary.m4
^
|
@@ -5,15 +5,16 @@
[AC_LANG_PUSH([C])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -I${srcdir}"
- AC_RUN_IFELSE([
+ AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
+#include <inttypes.h>
#include "libmemcached/memcached/protocol_binary.h"
]],[[
protocol_binary_request_set request;
if (sizeof(request) != sizeof(request.bytes)) {
return 1;
}
- ]])],, AC_MSG_ERROR([Unsupported struct padding done by compiler.]))
+ ]])],, AC_MSG_ERROR([Unsupported struct padding done by compiler.]))
CFLAGS="$save_CFLAGS"
AC_LANG_POP
])
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/support/libmemcached-fc.spec.in
^
|
@@ -4,7 +4,7 @@
Release: 1%{?dist}
License: BSD
Group: System Environment/Libraries
-URL: http://tangent.org/552/libmemcached.html
+URL: http://libmemcached.org/
Source0: http://download.tangent.org/libmemcached-%{version}.tar.gz
# For test suite
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/support/libmemcached.spec
^
|
@@ -1,6 +1,6 @@
Name: libmemcached
Summary: memcached C library and command line tools
-Version: 0.38
+Version: 0.40
Release: 1
License: BSD
Group: System Environment/Libraries
@@ -108,6 +108,7 @@
%{_includedir}/libmemcached/hash.h
%{_includedir}/libmemcached/parse.h
%{_includedir}/libmemcached/quit.h
+%{_includedir}/libmemcached/sasl.h
%{_includedir}/libmemcached/strerror.h
%{_includedir}/libmemcached/verbosity.h
%{_includedir}/libmemcached/version.h
@@ -137,6 +138,7 @@
%{_includedir}/libmemcached/protocol_handler.h
%{_includedir}/libmemcached/result.h
%{_includedir}/libmemcached/server.h
+%{_includedir}/libmemcached/server_list.h
%{_includedir}/libmemcached/stats.h
%{_includedir}/libmemcached/storage.h
%{_includedir}/libmemcached/string.h
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/support/libmemcached.spec.in
^
|
@@ -108,6 +108,7 @@
%{_includedir}/libmemcached/hash.h
%{_includedir}/libmemcached/parse.h
%{_includedir}/libmemcached/quit.h
+%{_includedir}/libmemcached/sasl.h
%{_includedir}/libmemcached/strerror.h
%{_includedir}/libmemcached/verbosity.h
%{_includedir}/libmemcached/version.h
@@ -137,6 +138,7 @@
%{_includedir}/libmemcached/protocol_handler.h
%{_includedir}/libmemcached/result.h
%{_includedir}/libmemcached/server.h
+%{_includedir}/libmemcached/server_list.h
%{_includedir}/libmemcached/stats.h
%{_includedir}/libmemcached/storage.h
%{_includedir}/libmemcached/string.h
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/tests/hashkit_functions.c
^
|
@@ -248,7 +248,7 @@
static test_return_t murmur_run (hashkit_st *hashk __attribute__((unused)))
{
-#ifdef __sparc
+#ifdef WORDS_BIGENDIAN
return TEST_SKIPPED;
#else
uint32_t x;
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/tests/include.am
^
|
@@ -41,7 +41,8 @@
tests/startservers \
tests/testapp \
tests/testhashkit \
- tests/testplus
+ tests/testplus \
+ tests/testudp
noinst_LTLIBRARIES+= tests/libserver.la
tests_libserver_la_SOURCES= tests/server.c
@@ -51,41 +52,50 @@
tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
tests_testapp_SOURCES= tests/mem_functions.c
-tests_testapp_LDADD= \
+tests_testapp_DEPENDENCIES= \
clients/libgenexec.la \
tests/libserver.la \
tests/libtest.la \
libmemcached/libmemcachedinternal.la \
-$(TESTS_LDADDS)
-tests_testapp_DEPENDENCIES= $(tests_testapp_LDADD)
+ $(TESTS_LDADDS)
+tests_testapp_LDADD= $(tests_testapp_DEPENDENCIES) $(LIBSASL)
tests_testplus_SOURCES= tests/plus.cpp
-tests_testplus_LDADD= tests/libtest.la tests/libserver.la $(TESTS_LDADDS)
-tests_testplus_DEPENDENCIES= $(tests_testplus_LDADD)
+tests_testplus_DEPENDENCIES= tests/libtest.la tests/libserver.la $(TESTS_LDADDS)
+tests_testplus_LDADD= $(tests_testplus_DEPENDENCIES) $(LIBSASL)
tests_atomsmasher_SOURCES= tests/atomsmasher.c
-tests_atomsmasher_LDADD= \
+tests_atomsmasher_DEPENDENCIES= \
clients/libgenexec.la \
tests/libserver.la \
tests/libtest.la \
$(TESTS_LDADDS)
-tests_atomsmasher_DEPENDENCIES= $(tests_atomsmasher_LDADD)
+tests_atomsmasher_LDADD= $(tests_atomsmasher_DEPENDENCIES) $(LIBSASL)
+
+tests_testudp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
+tests_testudp_SOURCES= tests/mem_udp.c
+tests_testudp_DEPENDENCIES= \
+ clients/libgenexec.la \
+ tests/libserver.la \
+ tests/libtest.la \
+ $(TESTS_LDADDS)
+tests_testudp_LDADD= $(tests_testudp_DEPENDENCIES) $(LIBSASL)
tests_startservers_SOURCES= tests/start.c
-tests_startservers_LDADD= tests/libserver.la $(TESTS_LDADDS)
-tests_startservers_DEPENDENCIES= $(tests_startservers_LDADD)
+tests_startservers_DEPENDENCIES= tests/libserver.la $(TESTS_LDADDS)
+tests_startservers_LDADD= $(tests_startservers_DEPENDENCIES) $(LIBSASL)
tests_testhashkit_SOURCES = tests/hashkit_functions.c
-tests_testhashkit_LDADD = tests/libtest.la libhashkit/libhashkit.la
-tests_testhashkit_DEPENDENCIES = $(tests_testhashkit_LDADD)
+tests_testhashkit_DEPENDENCIES = tests/libtest.la libhashkit/libhashkit.la
+tests_testhashkit_LDADD = $(tests_testhashkit_DEPENDENCIES) $(LIBSASL)
tests_hashplus_SOURCES = tests/hash_plus.cc
-tests_hashplus_LDADD = $(tests_testhashkit_LDADD)
-tests_hashplus_DEPENDENCIES = $(tests_testhashkit_LDADD)
+tests_hashplus_DEPENDENCIES = $(tests_testhashkit_DEPENDENCIES)
+tests_hashplus_LDADD = $(tests_testhashkit_DEPENDENCIES) $(LIBSASL)
tests_memplus_SOURCES = tests/mem_plus.cc
-tests_memplus_LDADD = tests/libtest.la tests/libserver.la libmemcached/libmemcached.la
-tests_memplus_DEPENDENCIES = $(tests_memplus_LDADD)
+tests_memplus_DEPENDENCIES = tests/libtest.la tests/libserver.la libmemcached/libmemcached.la
+tests_memplus_LDADD = $(tests_memplus_DEPENDENCIES)
test: test-docs test-mem test-hash memcapable
echo "Tests completed"
@@ -151,21 +161,21 @@
test-memflush: clients/memflush
@echo "Testing memflush"
- @/usr/local/bin/memcached -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memflush --servers="localhost:12555"
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@rm tests/Xumemc.pid
valgrind-memflush: clients/memflush
@echo "Testing memflush"
- @/usr/local/bin/memcached -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
@$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@rm tests/Xumemc.pid
test-memdump: clients/memdump clients/memcp
@echo "Testing memdump"
- @/usr/local/bin/memcached -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memcp --servers="localhost:12555" clients/memcat
@clients/memdump --servers="localhost:12555" > /dev/null
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@@ -173,7 +183,7 @@
valgrind-memdump: clients/memcat clients/memcp
@echo "Testing memdump"
- @/usr/local/bin/memcached -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memcp --servers="localhost:12555" clients/memcat
@$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@@ -181,14 +191,14 @@
test-memstat: clients/memstat
@echo "Testing memstat"
- @/usr/local/bin/memcached -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memstat --servers="localhost:12555" > /dev/null
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@rm tests/Xumemc.pid
valgrind-memstat: clients/memstat
@echo "Testing memstat"
- @/usr/local/bin/memcached -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
@$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@rm tests/Xumemc.pid
@@ -217,11 +227,16 @@
ATOM_COMMAND= tests/atomsmasher $(COLLECTION) $(SUITE)
+UDP_COMMAND= tests/testudp $(COLLECTION) $(SUITE)
+
HASH_COMMAND= tests/testhashkit $(COLLECTION) $(SUITE)
test-mem: tests/testapp
$(MEM_COMMAND)
+test-udp: tests/testudp
+ $(UDP_COMMAND)
+
test-atom: tests/atomsmasher
$(ATOM_COMMAND)
@@ -244,6 +259,9 @@
$(DEBUG_COMMAND) $(MEM_COMMAND)
gdb-atom: tests/atomsmasher
+ $(DEBUG_COMMAND) $(UDP_COMMAND)
+
+gdb-udp: tests/testudp
$(DEBUG_COMMAND) $(ATOM_COMMAND)
gdb-plus: tests/testplus
@@ -267,6 +285,9 @@
valgrind-atom: tests/atomsmasher
$(VALGRIND_COMMAND) $(ATOM_COMMAND)
+valgrind-udp: tests/testudp
+ $(VALGRIND_COMMAND) $(UDP_COMMAND)
+
valgrind-plus: tests/testplus
$(VALGRIND_COMMAND) $(TESTPLUS_COMMAND)
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/tests/libmemcached_world.h
^
|
@@ -96,10 +96,10 @@
test_return_t world_pre_run(libmemcached_test_container_st *container)
{
- for (uint32_t loop= 0; loop < memcached_server_list_count(container->construct.servers); loop++)
+ for (uint32_t loop= 0; loop < memcached_server_list_count(container->memc->servers); loop++)
{
- memcached_server_st *instance=
- memcached_server_instance_fetch(container->memc, loop);
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(container->memc, loop);
test_true(instance->fd == -1);
test_true(instance->cursor_active == 0);
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/tests/mem_functions.c
^
|
@@ -52,6 +52,10 @@
static const char *global_keys[GLOBAL_COUNT];
static size_t global_keys_length[GLOBAL_COUNT];
+// Prototype
+static test_return_t pre_binary(memcached_st *memc);
+
+
static test_return_t init_test(memcached_st *not_used __attribute__((unused)))
{
memcached_st memc;
@@ -83,12 +87,13 @@
in_port_t test_ports[TEST_PORT_COUNT];
static memcached_return_t server_display_function(const memcached_st *ptr __attribute__((unused)),
- memcached_server_st *server, void *context)
+ const memcached_server_st *server,
+ void *context)
{
/* Do Nothing */
size_t bigger= *((size_t *)(context));
- assert(bigger <= server->port);
- *((size_t *)(context))= server->port;
+ assert(bigger <= memcached_server_port(server));
+ *((size_t *)(context))= memcached_server_port(server);
return MEMCACHED_SUCCESS;
}
@@ -110,7 +115,9 @@
test_ports[x]= (in_port_t)random() % 64000;
rc= memcached_server_add_with_weight(local_memc, "localhost", test_ports[x], 0);
test_true(memcached_server_count(local_memc) == x + 1);
- test_true(memcached_servers_count(memcached_server_list(local_memc)) == x+1);
+#if 0 // Rewrite
+ test_true(memcached_server_list_count(memcached_server_list(local_memc)) == x+1);
+#endif
test_true(rc == MEMCACHED_SUCCESS);
}
@@ -129,7 +136,7 @@
memcached_return_t rc;
memcached_server_fn callbacks[1];
memcached_st *local_memc;
- memcached_server_instance_st *instance;
+ memcached_server_instance_st instance;
local_memc= memcached_create(NULL);
test_true(local_memc);
@@ -138,17 +145,17 @@
rc= memcached_server_add_with_weight(local_memc, "MEMCACHED_BEHAVIOR_SORT_HOSTS", 43043, 0);
test_true(rc == MEMCACHED_SUCCESS);
- instance= memcached_server_instance_fetch(local_memc, 0);
- test_true(instance->port == 43043);
+ instance= memcached_server_instance_by_position(local_memc, 0);
+ test_true(memcached_server_port(instance) == 43043);
rc= memcached_server_add_with_weight(local_memc, "MEMCACHED_BEHAVIOR_SORT_HOSTS", 43042, 0);
test_true(rc == MEMCACHED_SUCCESS);
- instance= memcached_server_instance_fetch(local_memc, 0);
- test_true(instance->port == 43042);
+ instance= memcached_server_instance_by_position(local_memc, 0);
+ test_true(memcached_server_port(instance) == 43042);
- instance= memcached_server_instance_fetch(local_memc, 1);
- test_true(instance->port == 43043);
+ instance= memcached_server_instance_by_position(local_memc, 1);
+ test_true(memcached_server_port(instance) == 43043);
callbacks[0]= server_display_function;
memcached_server_cursor(local_memc, callbacks, (void *)&bigger, 1);
@@ -159,7 +166,47 @@
return TEST_SUCCESS;
}
-static memcached_return_t server_display_unsort_function(const memcached_st *ptr __attribute__((unused)), memcached_server_st *server, void *context)
+static memcached_return_t server_print_callback(const memcached_st *ptr __attribute__((unused)),
+ const memcached_server_st *server,
+ void *context __attribute__((unused)))
+{
+ (void)server; // Just in case we aren't printing.
+
+#if 0
+ fprintf(stderr, "%s(%d)", memcached_server_name(server), memcached_server_port(server));
+#endif
+
+ return MEMCACHED_SUCCESS;
+}
+
+static test_return_t memcached_server_remove_test(memcached_st *ptr __attribute__((unused)))
+{
+ memcached_return_t rc;
+ memcached_st local_memc;
+ memcached_st *memc;
+ memcached_server_st *servers;
+ memcached_server_fn callbacks[1];
+
+ const char *server_string= "localhost:4444, localhost:4445, localhost:4446, localhost:4447, localhost, memcache1.memcache.bk.sapo.pt:11211, memcache1.memcache.bk.sapo.pt:11212, memcache1.memcache.bk.sapo.pt:11213, memcache1.memcache.bk.sapo.pt:11214, memcache2.memcache.bk.sapo.pt:11211, memcache2.memcache.bk.sapo.pt:11212, memcache2.memcache.bk.sapo.pt:11213, memcache2.memcache.bk.sapo.pt:11214";
+
+ memc= memcached_create(&local_memc);
+
+ servers= memcached_servers_parse(server_string);
+
+ rc= memcached_server_push(memc, servers);
+ memcached_server_list_free(servers);
+
+ callbacks[0]= server_print_callback;
+ memcached_server_cursor(memc, callbacks, NULL, 1);
+
+ memcached_free(memc);
+
+ return TEST_SUCCESS;
+}
+
+static memcached_return_t server_display_unsort_function(const memcached_st *ptr __attribute__((unused)),
+ const memcached_server_st *server,
+ void *context)
{
/* Do Nothing */
uint32_t x= *((uint32_t *)(context));
@@ -186,7 +233,9 @@
test_ports[x]= (in_port_t)(random() % 64000);
rc= memcached_server_add_with_weight(local_memc, "localhost", test_ports[x], 0);
test_true(memcached_server_count(local_memc) == x+1);
- test_true(memcached_servers_count(memcached_server_list(local_memc)) == x+1);
+#if 0 // Rewrite
+ test_true(memcached_server_list_count(memcached_server_list(local_memc)) == x+1);
+#endif
test_true(rc == MEMCACHED_SUCCESS);
}
@@ -332,10 +381,11 @@
4269430871U, 610793021U, 527273862U, 1437122909U,
2300930706U, 2943759320U, 674306647U, 2400528935U,
54481931U, 4186304426U, 1741088401U, 2979625118U,
- 4159057246U, 3425930182U, 2593724503U, 1868899624U};
+ 4159057246U, 3425930182U, 2593724503U, 1868899624U,
+ 1769812374U, 2302537950U, 1110330676U };
// You have updated the memcache_error messages but not updated docs/tests.
- test_true(MEMCACHED_MAXIMUM_RETURN == 40);
+ test_true(MEMCACHED_MAXIMUM_RETURN == 43);
for (rc= MEMCACHED_SUCCESS; rc < MEMCACHED_MAXIMUM_RETURN; rc++)
{
uint32_t hash_val;
@@ -530,7 +580,7 @@
test_true(rc == MEMCACHED_SUCCESS);
uint64_t cas = memcached_result_cas(results);
- #if 0
+#if 0
results= memcached_fetch_result(memc, &results_obj, &rc);
test_true(rc == MEMCACHED_END);
test_true(results == NULL);
@@ -695,7 +745,7 @@
}
static memcached_return_t server_function(const memcached_st *ptr __attribute__((unused)),
- memcached_server_st *server __attribute__((unused)),
+ const memcached_server_st *server __attribute__((unused)),
void *context __attribute__((unused)))
{
/* Do Nothing */
@@ -1168,12 +1218,16 @@
{
memcached_return_t rc;
memcached_stat_st memc_stat;
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc, 0);
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, 0);
+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+ if (memcached_get_sasl_callbacks(memc) != NULL)
+ return TEST_SKIPPED;
+#endif
rc= memcached_stat_servername(&memc_stat, NULL,
- instance->hostname,
- instance->port);
+ memcached_server_name(instance),
+ memcached_server_port(instance));
return TEST_SUCCESS;
}
@@ -1617,7 +1671,7 @@
uint32_t number_of_hosts= memc->number_of_hosts;
memc->number_of_hosts= 1;
- size_t max_keys= binary ? 20480 : 1;
+ size_t max_keys= 20480;
char **keys= calloc(max_keys, sizeof(char*));
@@ -1626,6 +1680,7 @@
/* First add all of the items.. */
char blob[1024] = {0};
memcached_return_t rc;
+
for (size_t x= 0; x < max_keys; ++x)
{
char k[251];
@@ -1643,21 +1698,23 @@
rc= memcached_mget_execute(memc, (const char**)keys, key_length,
max_keys, callbacks, &counter, 1);
- if (binary)
+ if (rc == MEMCACHED_SUCCESS)
{
- test_true(rc == MEMCACHED_SUCCESS);
-
+ test_true(binary);
rc= memcached_fetch_execute(memc, callbacks, (void *)&counter, 1);
test_true(rc == MEMCACHED_END);
/* Verify that we got all of the items */
test_true(counter == max_keys);
}
- else
+ else if (rc == MEMCACHED_NOT_SUPPORTED)
{
- test_true(rc == MEMCACHED_NOT_SUPPORTED);
test_true(counter == 0);
}
+ else
+ {
+ test_fail("note: this test functions differently when in binary mode");
+ }
/* Release all allocated resources */
for (size_t x= 0; x < max_keys; ++x)
@@ -1671,6 +1728,51 @@
return TEST_SUCCESS;
}
+#define REGRESSION_BINARY_VS_BLOCK_COUNT 20480
+
+static test_return_t key_setup(memcached_st *memc)
+{
+ (void)memc;
+
+ if (pre_binary(memc) != TEST_SUCCESS)
+ return TEST_SKIPPED;
+
+ global_pairs= pairs_generate(REGRESSION_BINARY_VS_BLOCK_COUNT, 0);
+
+ return TEST_SUCCESS;
+}
+
+static test_return_t key_teardown(memcached_st *memc)
+{
+ (void)memc;
+ pairs_free(global_pairs);
+
+ return TEST_SUCCESS;
+}
+
+static test_return_t block_add_regression(memcached_st *memc)
+{
+ /* First add all of the items.. */
+ for (size_t x= 0; x < REGRESSION_BINARY_VS_BLOCK_COUNT; ++x)
+ {
+ memcached_return_t rc;
+ char blob[1024] = {0};
+
+ rc= memcached_add_by_key(memc, "bob", 3, global_pairs[x].key, global_pairs[x].key_length, blob, sizeof(blob), 0, 0);
+ test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
+ }
+
+ return TEST_SUCCESS;
+}
+
+static test_return_t binary_add_regression(memcached_st *memc)
+{
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1);
+ test_return_t rc= block_add_regression(memc);
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 0);
+ return rc;
+}
+
static test_return_t get_stats_keys(memcached_st *memc)
{
char **stat_list;
@@ -1889,6 +1991,54 @@
return TEST_SUCCESS;
}
+
+static test_return_t MEMCACHED_BEHAVIOR_TCP_KEEPALIVE_test(memcached_st *memc)
+{
+ memcached_return_t rc;
+ bool set= true;
+ bool value;
+
+ rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_KEEPALIVE, set);
+ test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_NOT_SUPPORTED);
+
+ value= (bool)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_TCP_KEEPALIVE);
+
+ if (rc == MEMCACHED_SUCCESS)
+ {
+ test_true((bool)value == set);
+ }
+ else
+ {
+ test_false((bool)value == set);
+ }
+
+ return TEST_SUCCESS;
+}
+
+
+static test_return_t MEMCACHED_BEHAVIOR_TCP_KEEPIDLE_test(memcached_st *memc)
+{
+ memcached_return_t rc;
+ bool set= true;
+ bool value;
+
+ rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_KEEPIDLE, set);
+ test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_NOT_SUPPORTED);
+
+ value= (bool)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_TCP_KEEPIDLE);
+
+ if (rc == MEMCACHED_SUCCESS)
+ {
+ test_true((bool)value == set);
+ }
+ else
+ {
+ test_false((bool)value == set);
+ }
+
+ return TEST_SUCCESS;
+}
+
static test_return_t fetch_all_results(memcached_st *memc)
{
memcached_return_t rc= MEMCACHED_SUCCESS;
@@ -2666,22 +2816,21 @@
From Andrei on IRC
*/
-static test_return_t user_supplied_bug19(memcached_st *memc)
+static test_return_t user_supplied_bug19(memcached_st *not_used)
{
- memcached_st *m;
- memcached_server_st *s;
+ memcached_st *memc;
+ const memcached_server_st *server;
memcached_return_t res;
- (void)memc;
+ (void)not_used;
- m= memcached_create(NULL);
- memcached_server_add_with_weight(m, "localhost", 11311, 100);
- memcached_server_add_with_weight(m, "localhost", 11312, 100);
+ memc= memcached_create(NULL);
+ memcached_server_add_with_weight(memc, "localhost", 11311, 100);
+ memcached_server_add_with_weight(memc, "localhost", 11312, 100);
- s= memcached_server_by_key(m, "a", 1, &res);
- memcached_server_free(s);
+ server= memcached_server_by_key(memc, "a", 1, &res);
- memcached_free(m);
+ memcached_free(memc);
return TEST_SUCCESS;
}
@@ -2768,9 +2917,11 @@
for (x= 0; x < 99; x++)
{
uint32_t server_idx = memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key));
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc, server_idx);
- char *hostname = instance->hostname;
+
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, server_idx);
+
+ const char *hostname = memcached_server_name(instance);
test_strcmp(hostname, ketama_test_cases[x].server);
}
@@ -2846,8 +2997,6 @@
return TEST_SUCCESS;
}
-static test_return_t pre_binary(memcached_st *memc);
-
static test_return_t user_supplied_bug21(memcached_st *memc)
{
test_return_t test_rc;
@@ -2872,7 +3021,7 @@
static test_return_t auto_eject_hosts(memcached_st *trash)
{
(void) trash;
- memcached_server_instance_st *instance;
+ memcached_server_instance_st instance;
memcached_return_t rc;
memcached_st *memc= memcached_create(NULL);
@@ -2913,18 +3062,22 @@
test_true(server_pool[7].port == 11211);
test_true(server_pool[7].weight == 100);
- instance= memcached_server_instance_fetch(memc, 2);
- instance->next_retry = time(NULL) + 15;
+ instance= memcached_server_instance_by_position(memc, 2);
+ ((memcached_server_write_instance_st)instance)->next_retry = time(NULL) + 15;
memc->next_distribution_rebuild= time(NULL) - 1;
+ /*
+ This would not work if there were only two hosts.
+ */
for (size_t x= 0; x < 99; x++)
{
- uint32_t server_idx = memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key));
+ memcached_autoeject(memc);
+ uint32_t server_idx= memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key));
test_true(server_idx != 2);
}
/* and re-added when it's back. */
- instance->next_retry = time(NULL) - 1;
+ ((memcached_server_write_instance_st)instance)->next_retry = time(NULL) - 1;
memc->next_distribution_rebuild= time(NULL) - 1;
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION,
memc->distribution);
@@ -2933,8 +3086,8 @@
uint32_t server_idx = memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key));
// We re-use instance from above.
instance=
- memcached_server_instance_fetch(memc, server_idx);
- char *hostname = instance->hostname;
+ memcached_server_instance_by_position(memc, server_idx);
+ const char *hostname = memcached_server_name(instance);
test_true(strcmp(hostname, ketama_test_cases[x].server) == 0);
}
@@ -3203,8 +3356,8 @@
{
/* This test was changes so that "make test" would work properlly */
#ifdef DEBUG
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc, host_index);
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, host_index);
printf("\nserver %u|%s|%u bytes: %llu\n", host_index, instance->hostname, instance->port, (unsigned long long)(stat_p + host_index)->bytes);
#endif
@@ -3420,7 +3573,7 @@
static test_return_t pre_cork_and_nonblock(memcached_st *memc)
{
test_return_t rc;
-
+
rc= pre_cork(memc);
#ifdef __APPLE__
@@ -3437,7 +3590,7 @@
{
memcached_return_t rc= MEMCACHED_FAILURE;
memcached_st *memc_clone;
- memcached_server_instance_st *instance;
+ memcached_server_instance_st instance;
memc_clone= memcached_clone(NULL, memc);
test_true(memc_clone);
@@ -3445,7 +3598,7 @@
// will not toggle protocol on an connection.
memcached_version(memc_clone);
- instance= memcached_server_instance_fetch(memc_clone, 0);
+ instance= memcached_server_instance_by_position(memc_clone, 0);
if (instance->major_version >= 1 && instance->minor_version > 2)
{
@@ -3573,7 +3726,7 @@
{
memcached_return_t rc= MEMCACHED_FAILURE;
memcached_st *memc_clone;
- memcached_server_instance_st *instance;
+ memcached_server_instance_st instance;
memc_clone= memcached_clone(NULL, memc);
test_true(memc_clone);
@@ -3581,7 +3734,7 @@
// will not toggle protocol on an connection.
memcached_version(memc_clone);
- instance= memcached_server_instance_fetch(memc_clone, 0);
+ instance= memcached_server_instance_by_position(memc_clone, 0);
if (instance->major_version >= 1 && instance->minor_version > 2)
{
@@ -3595,6 +3748,31 @@
return rc == MEMCACHED_SUCCESS ? TEST_SUCCESS : TEST_SKIPPED;
}
+static test_return_t pre_sasl(memcached_st *memc)
+{
+ memcached_return_t rc= MEMCACHED_FAILURE;
+
+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+ const char *server= getenv("LIBMEMCACHED_TEST_SASL_SERVER");
+ const char *user= getenv("LIBMEMCACHED_TEST_SASL_USERNAME");
+ const char *pass= getenv("LIBMEMCACHED_TEST_SASL_PASSWORD");
+
+ if (server != NULL && user != NULL && pass != NULL)
+ {
+ memcached_server_st *servers= memcached_servers_parse(server);
+ test_true(servers != NULL);
+ memcached_servers_reset(memc);
+ test_true(memcached_server_push(memc, servers) == MEMCACHED_SUCCESS);
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1);
+ rc= memcached_set_sasl_auth_data(memc, user, pass);
+ test_true(rc == MEMCACHED_SUCCESS);
+ }
+#else
+ (void)memc;
+#endif
+
+ return rc == MEMCACHED_SUCCESS ? TEST_SUCCESS : TEST_SKIPPED;
+}
static test_return_t pre_replication(memcached_st *memc)
{
@@ -3892,8 +4070,8 @@
{
unsigned int set= 1;
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc, 0);
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, 0);
memcached_version(memc);
@@ -3911,8 +4089,9 @@
static test_return_t check_for_1_2_3(memcached_st *memc)
{
memcached_version(memc);
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc, 0);
+
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, 0);
if ((instance->major_version >= 1 && (instance->minor_version == 2 && instance->micro_version >= 4))
|| instance->minor_version > 2)
@@ -4018,8 +4197,8 @@
int no_msg=0;
for (uint32_t x= 0; x < memcached_server_count(memc); ++x)
{
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc, x);
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, x);
no_msg+=(int)(instance->cursor_active);
}
@@ -4204,7 +4383,7 @@
rc= memcached_set(mmc[0], key, keylen, "0", 1, 0, 0);
test_true(rc == MEMCACHED_SUCCESS);
- for (size_t x= 0; x < 10; ++x)
+ for (size_t x= 0; x < 10; ++x)
{
uint64_t number_value;
rc= memcached_increment(mmc[x], key, keylen, 1, &number_value);
@@ -4305,10 +4484,10 @@
for (uint32_t host= 0; host < memcached_server_count(memc); ++host)
{
memcached_st *memc_clone= memcached_clone(NULL, memc);
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc_clone, host);
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc_clone, host);
- instance->port= 0;
+ ((memcached_server_write_instance_st)instance)->port= 0;
for (int x= 'a'; x <= 'z'; ++x)
{
@@ -4367,9 +4546,9 @@
for (uint32_t host= 0; host < memc_clone->number_of_hosts; host++)
{
memcached_st *new_clone= memcached_clone(NULL, memc);
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(new_clone, host);
- instance->port= 0;
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(new_clone, host);
+ ((memcached_server_write_instance_st)instance)->port= 0;
for (int x= 'a'; x <= 'z'; ++x)
{
@@ -4409,7 +4588,7 @@
const char *keys[]= { "key1", "key2", "key3", "key4", "key5", "key6", "key7" };
size_t len[]= { 4, 4, 4, 4, 4, 4, 4 };
- for (int x=0; x< 7; ++x)
+ for (size_t x= 0; x< 7; ++x)
{
rc= memcached_set(memc, keys[x], len[x], "1", 1, 0, 0);
test_true(rc == MEMCACHED_SUCCESS);
@@ -4465,10 +4644,10 @@
uint32_t hash= memcached_generate_hash(memc, keys[0], len[0]);
for (uint32_t x= 0; x < (repl + 1); ++x)
{
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc_clone, x);
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc_clone, x);
- instance->port= 0;
+ ((memcached_server_write_instance_st)instance)->port= 0;
if (++hash == memc_clone->number_of_hosts)
hash= 0;
}
@@ -4500,390 +4679,6 @@
return TEST_SUCCESS;
}
-static void increment_request_id(uint16_t *id)
-{
- (*id)++;
- if ((*id & UDP_REQUEST_ID_THREAD_MASK) != 0)
- *id= 0;
-}
-
-static uint16_t *get_udp_request_ids(memcached_st *memc)
-{
- uint16_t *ids= malloc(sizeof(uint16_t) * memcached_server_count(memc));
- assert(ids != NULL);
-
- for (uint32_t x= 0; x < memcached_server_count(memc); x++)
- {
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc, x);
-
- ids[x]= get_udp_datagram_request_id((struct udp_datagram_header_st *) instance->write_buffer);
- }
-
- return ids;
-}
-
-static test_return_t post_udp_op_check(memcached_st *memc, uint16_t *expected_req_ids)
-{
- memcached_server_st *cur_server = memcached_server_list(memc);
- uint16_t *cur_req_ids = get_udp_request_ids(memc);
-
- for (size_t x= 0; x < memcached_server_count(memc); x++)
- {
- test_true(cur_server[x].cursor_active == 0);
- test_true(cur_req_ids[x] == expected_req_ids[x]);
- }
- free(expected_req_ids);
- free(cur_req_ids);
-
- return TEST_SUCCESS;
-}
-
-/*
-** There is a little bit of a hack here, instead of removing
-** the servers, I just set num host to 0 and them add then new udp servers
-**/
-static test_return_t init_udp(memcached_st *memc)
-{
- memcached_version(memc);
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc, 0);
-
- /* For the time being, only support udp test for >= 1.2.6 && < 1.3 */
- if (instance->major_version != 1 || instance->minor_version != 2
- || instance->micro_version < 6)
- return TEST_SKIPPED;
-
- uint32_t num_hosts= memcached_server_count(memc);
- memcached_server_st servers[num_hosts];
- memcpy(servers, memcached_server_list(memc), sizeof(memcached_server_st) * num_hosts);
- for (uint32_t x= 0; x < num_hosts; x++)
- {
- memcached_server_instance_st *set_instance=
- memcached_server_instance_fetch(memc, x);
-
- memcached_server_free(set_instance);
- }
-
- memc->number_of_hosts= 0;
- memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_USE_UDP, 1);
- for (uint32_t x= 0; x < num_hosts; x++)
- {
- memcached_server_instance_st *set_instance=
- memcached_server_instance_fetch(memc, x);
-
- test_true(memcached_server_add_udp(memc, servers[x].hostname, servers[x].port) == MEMCACHED_SUCCESS);
- test_true(set_instance->write_buffer_offset == UDP_DATAGRAM_HEADER_LENGTH);
- }
-
- return TEST_SUCCESS;
-}
-
-static test_return_t binary_init_udp(memcached_st *memc)
-{
- test_return_t test_rc;
- test_rc= pre_binary(memc);
-
- if (test_rc != TEST_SUCCESS)
- return test_rc;
-
- return init_udp(memc);
-}
-
-/* Make sure that I cant add a tcp server to a udp client */
-static test_return_t add_tcp_server_udp_client_test(memcached_st *memc)
-{
- (void)memc;
-#if 0
- memcached_server_st server;
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc, 0);
- memcached_server_clone(&server, &memc->hosts[0]);
- test_true(memcached_server_remove(&(memc->hosts[0])) == MEMCACHED_SUCCESS);
- test_true(memcached_server_add(memc, server.hostname, server.port) == MEMCACHED_INVALID_HOST_PROTOCOL);
-#endif
- return TEST_SUCCESS;
-}
-
-/* Make sure that I cant add a udp server to a tcp client */
-static test_return_t add_udp_server_tcp_client_test(memcached_st *memc)
-{
- (void)memc;
-#if 0
- memcached_server_st server;
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc, 0);
- memcached_server_clone(&server, &memc->hosts[0]);
- test_true(memcached_server_remove(&(memc->hosts[0])) == MEMCACHED_SUCCESS);
-
- memcached_st tcp_client;
- memcached_create(&tcp_client);
- test_true(memcached_server_add_udp(&tcp_client, server.hostname, server.port) == MEMCACHED_INVALID_HOST_PROTOCOL);
-#endif
-
- return TEST_SUCCESS;
-}
-
-static test_return_t set_udp_behavior_test(memcached_st *memc)
-{
-
- memcached_quit(memc);
- memc->number_of_hosts= 0;
- memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, memc->distribution);
- test_true(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_USE_UDP, 1) == MEMCACHED_SUCCESS);
- test_true(memc->flags.use_udp);
- test_true(memc->flags.no_reply);
-
- test_true(memcached_server_count(memc) == 0);
-
- memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_USE_UDP,0);
- test_true(! (memc->flags.use_udp));
- memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NOREPLY,0);
- test_true(! (memc->flags.no_reply));
-
- return TEST_SUCCESS;
-}
-
-static test_return_t udp_set_test(memcached_st *memc)
-{
- unsigned int num_iters= 1025; //request id rolls over at 1024
-
- for (size_t x= 0; x < num_iters;x++)
- {
- memcached_return_t rc;
- const char *key= "foo";
- const char *value= "when we sanitize";
- uint16_t *expected_ids= get_udp_request_ids(memc);
- unsigned int server_key= memcached_generate_hash(memc, key, strlen(key));
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc, server_key);
- size_t init_offset= instance->write_buffer_offset;
-
- rc= memcached_set(memc, key, strlen(key),
- value, strlen(value),
- (time_t)0, (uint32_t)0);
- test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
- /** NB, the check below assumes that if new write_ptr is less than
- * the original write_ptr that we have flushed. For large payloads, this
- * maybe an invalid assumption, but for the small payload we have it is OK
- */
- if (rc == MEMCACHED_SUCCESS ||
- instance->write_buffer_offset < init_offset)
- increment_request_id(&expected_ids[server_key]);
-
- if (rc == MEMCACHED_SUCCESS)
- {
- test_true(instance->write_buffer_offset == UDP_DATAGRAM_HEADER_LENGTH);
- }
- else
- {
- test_true(instance->write_buffer_offset != UDP_DATAGRAM_HEADER_LENGTH);
- test_true(instance->write_buffer_offset <= MAX_UDP_DATAGRAM_LENGTH);
- }
- test_true(post_udp_op_check(memc, expected_ids) == TEST_SUCCESS);
- }
- return TEST_SUCCESS;
-}
-
-static test_return_t udp_buffered_set_test(memcached_st *memc)
-{
- memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 1);
- return udp_set_test(memc);
-}
-
-static test_return_t udp_set_too_big_test(memcached_st *memc)
-{
- memcached_return_t rc;
- const char *key= "bar";
- char value[MAX_UDP_DATAGRAM_LENGTH];
- uint16_t *expected_ids= get_udp_request_ids(memc);
- rc= memcached_set(memc, key, strlen(key),
- value, MAX_UDP_DATAGRAM_LENGTH,
- (time_t)0, (uint32_t)0);
- test_true(rc == MEMCACHED_WRITE_FAILURE);
-
- return post_udp_op_check(memc,expected_ids);
-}
-
-static test_return_t udp_delete_test(memcached_st *memc)
-{
- unsigned int num_iters= 1025; //request id rolls over at 1024
-
- for (size_t x= 0; x < num_iters;x++)
- {
- memcached_return_t rc;
- const char *key= "foo";
- uint16_t *expected_ids=get_udp_request_ids(memc);
- unsigned int server_key= memcached_generate_hash(memc, key, strlen(key));
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc, server_key);
- size_t init_offset= instance->write_buffer_offset;
-
- rc= memcached_delete(memc, key, strlen(key), 0);
- test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
-
- if (rc == MEMCACHED_SUCCESS || instance->write_buffer_offset < init_offset)
- increment_request_id(&expected_ids[server_key]);
- if (rc == MEMCACHED_SUCCESS)
- {
- test_true(instance->write_buffer_offset == UDP_DATAGRAM_HEADER_LENGTH);
- }
- else
- {
- test_true(instance->write_buffer_offset != UDP_DATAGRAM_HEADER_LENGTH);
- test_true(instance->write_buffer_offset <= MAX_UDP_DATAGRAM_LENGTH);
- }
- test_true(post_udp_op_check(memc,expected_ids) == TEST_SUCCESS);
- }
- return TEST_SUCCESS;
-}
-
-static test_return_t udp_buffered_delete_test(memcached_st *memc)
-{
- memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 1);
- return udp_delete_test(memc);
-}
-
-static test_return_t udp_verbosity_test(memcached_st *memc)
-{
- memcached_return_t rc;
- uint16_t *expected_ids= get_udp_request_ids(memc);
-
- for (size_t x= 0; x < memcached_server_count(memc); x++)
- {
- increment_request_id(&expected_ids[x]);
- }
-
- rc= memcached_verbosity(memc,3);
- test_true(rc == MEMCACHED_SUCCESS);
- return post_udp_op_check(memc,expected_ids);
-}
-
-static test_return_t udp_quit_test(memcached_st *memc)
-{
- uint16_t *expected_ids= get_udp_request_ids(memc);
- memcached_quit(memc);
- return post_udp_op_check(memc, expected_ids);
-}
-
-static test_return_t udp_flush_test(memcached_st *memc)
-{
- memcached_return_t rc;
- uint16_t *expected_ids= get_udp_request_ids(memc);
-
- for (size_t x= 0; x < memcached_server_count(memc); x++)
- {
- increment_request_id(&expected_ids[x]);
- }
-
- rc= memcached_flush(memc,0);
- test_true(rc == MEMCACHED_SUCCESS);
- return post_udp_op_check(memc,expected_ids);
-}
-
-static test_return_t udp_incr_test(memcached_st *memc)
-{
- memcached_return_t rc;
- const char *key= "incr";
- const char *value= "1";
- rc= memcached_set(memc, key, strlen(key),
- value, strlen(value),
- (time_t)0, (uint32_t)0);
-
- test_true(rc == MEMCACHED_SUCCESS);
- uint16_t *expected_ids= get_udp_request_ids(memc);
- unsigned int server_key= memcached_generate_hash(memc, key, strlen(key));
- increment_request_id(&expected_ids[server_key]);
- uint64_t newvalue;
- rc= memcached_increment(memc, key, strlen(key), 1, &newvalue);
- test_true(rc == MEMCACHED_SUCCESS);
- return post_udp_op_check(memc, expected_ids);
-}
-
-static test_return_t udp_decr_test(memcached_st *memc)
-{
- memcached_return_t rc;
- const char *key= "decr";
- const char *value= "1";
- rc= memcached_set(memc, key, strlen(key),
- value, strlen(value),
- (time_t)0, (uint32_t)0);
-
- test_true(rc == MEMCACHED_SUCCESS);
- uint16_t *expected_ids= get_udp_request_ids(memc);
- unsigned int server_key= memcached_generate_hash(memc, key, strlen(key));
- increment_request_id(&expected_ids[server_key]);
- uint64_t newvalue;
- rc= memcached_decrement(memc, key, strlen(key), 1, &newvalue);
- test_true(rc == MEMCACHED_SUCCESS);
- return post_udp_op_check(memc, expected_ids);
-}
-
-
-static test_return_t udp_stat_test(memcached_st *memc)
-{
- memcached_stat_st * rv= NULL;
- memcached_return_t rc;
- char args[]= "";
- uint16_t *expected_ids = get_udp_request_ids(memc);
- rv = memcached_stat(memc, args, &rc);
- free(rv);
- test_true(rc == MEMCACHED_NOT_SUPPORTED);
- return post_udp_op_check(memc, expected_ids);
-}
-
-static test_return_t udp_version_test(memcached_st *memc)
-{
- memcached_return_t rc;
- uint16_t *expected_ids = get_udp_request_ids(memc);
- rc = memcached_version(memc);
- test_true(rc == MEMCACHED_NOT_SUPPORTED);
- return post_udp_op_check(memc, expected_ids);
-}
-
-static test_return_t udp_get_test(memcached_st *memc)
-{
- memcached_return_t rc;
- const char *key= "foo";
- size_t vlen;
- uint16_t *expected_ids = get_udp_request_ids(memc);
- char *val= memcached_get(memc, key, strlen(key), &vlen, (uint32_t)0, &rc);
- test_true(rc == MEMCACHED_NOT_SUPPORTED);
- test_true(val == NULL);
- return post_udp_op_check(memc, expected_ids);
-}
-
-static test_return_t udp_mixed_io_test(memcached_st *memc)
-{
- test_st current_op;
- test_st mixed_io_ops [] ={
- {"udp_set_test", 0,
- (test_callback_fn)udp_set_test},
- {"udp_set_too_big_test", 0,
- (test_callback_fn)udp_set_too_big_test},
- {"udp_delete_test", 0,
- (test_callback_fn)udp_delete_test},
- {"udp_verbosity_test", 0,
- (test_callback_fn)udp_verbosity_test},
- {"udp_quit_test", 0,
- (test_callback_fn)udp_quit_test},
- {"udp_flush_test", 0,
- (test_callback_fn)udp_flush_test},
- {"udp_incr_test", 0,
- (test_callback_fn)udp_incr_test},
- {"udp_decr_test", 0,
- (test_callback_fn)udp_decr_test},
- {"udp_version_test", 0,
- (test_callback_fn)udp_version_test}
- };
- for (size_t x= 0; x < 500; x++)
- {
- current_op= mixed_io_ops[random() % 9];
- test_true(current_op.test_fn(memc) == TEST_SUCCESS);
- }
- return TEST_SUCCESS;
-}
-
#if 0
static test_return_t hash_sanity_test (memcached_st *memc)
{
@@ -5051,7 +4846,7 @@
static test_return_t murmur_run (memcached_st *memc __attribute__((unused)))
{
-#ifdef __sparc
+#ifdef WORDS_BIGENDIAN
return TEST_SKIPPED;
#else
uint32_t x;
@@ -5102,7 +4897,8 @@
{
uint32_t x;
const char **ptr;
- hashkit_st *kit;
+ const hashkit_st *kit;
+ hashkit_st new_kit;
hashkit_return_t hash_rc;
uint32_t md5_hosts[]= {4U, 1U, 0U, 1U, 4U, 2U, 0U, 3U, 0U, 0U, 3U, 1U, 0U, 0U, 1U, 3U, 0U, 0U, 0U, 3U, 1U, 0U, 4U, 4U, 3U};
@@ -5110,9 +4906,12 @@
kit= memcached_get_hashkit(memc);
- hash_rc= hashkit_set_custom_function(kit, hash_md5_test_function, NULL);
+ hashkit_clone(&new_kit, kit);
+ hash_rc= hashkit_set_custom_function(&new_kit, hash_md5_test_function, NULL);
test_true(hash_rc == HASHKIT_SUCCESS);
+ memcached_set_hashkit(memc, &new_kit);
+
/*
Verify Setting the hash.
*/
@@ -5124,7 +4923,7 @@
test_true(md5_values[x] == hash_val);
}
-
+
/*
Now check memcached_st.
*/
@@ -5136,9 +4935,11 @@
test_true(md5_hosts[x] == hash_val);
}
- hash_rc= hashkit_set_custom_function(kit, hash_crc_test_function, NULL);
+ hash_rc= hashkit_set_custom_function(&new_kit, hash_crc_test_function, NULL);
test_true(hash_rc == HASHKIT_SUCCESS);
+ memcached_set_hashkit(memc, &new_kit);
+
/*
Verify Setting the hash.
*/
@@ -5209,9 +5010,9 @@
for (x= 0; x < 99; x++)
{
uint32_t server_idx = memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key));
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc, server_idx);
- char *hostname = instance->hostname;
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, server_idx);
+ const char *hostname = memcached_server_name(instance);
test_strcmp(hostname, ketama_test_cases[x].server);
}
@@ -5267,10 +5068,13 @@
/* verify the standard ketama set. */
for (x= 0; x < 99; x++)
{
- uint32_t server_idx = memcached_generate_hash(memc, ketama_test_cases_spy[x].key, strlen(ketama_test_cases_spy[x].key));
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc, server_idx);
- char *hostname = instance->hostname;
+ uint32_t server_idx= memcached_generate_hash(memc, ketama_test_cases_spy[x].key, strlen(ketama_test_cases_spy[x].key));
+
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, server_idx);
+
+ const char *hostname= memcached_server_name(instance);
+
test_strcmp(hostname, ketama_test_cases_spy[x].server);
}
@@ -5471,8 +5275,8 @@
static test_return_t regression_bug_447342(memcached_st *memc)
{
- memcached_server_instance_st *instance_one;
- memcached_server_instance_st *instance_two;
+ memcached_server_instance_st instance_one;
+ memcached_server_instance_st instance_two;
if (memcached_server_count(memc) < 3 || pre_replication(memc) != MEMCACHED_SUCCESS)
return TEST_SKIPPED;
@@ -5531,13 +5335,13 @@
* This is to verify correct behavior in the library. Fake that two servers
* are dead..
*/
- instance_one= memcached_server_instance_fetch(memc, 0);
- instance_two= memcached_server_instance_fetch(memc, 2);
+ instance_one= memcached_server_instance_by_position(memc, 0);
+ instance_two= memcached_server_instance_by_position(memc, 2);
in_port_t port0= instance_one->port;
in_port_t port2= instance_two->port;
- instance_one->port= 0;
- instance_two->port= 0;
+ ((memcached_server_write_instance_st)instance_one)->port= 0;
+ ((memcached_server_write_instance_st)instance_two)->port= 0;
rc= memcached_mget(memc, (const char* const *)keys, key_length, max_keys);
test_true(rc == MEMCACHED_SUCCESS);
@@ -5547,8 +5351,8 @@
test_true(counter == (unsigned int)max_keys);
/* restore the memc handle */
- instance_one->port= port0;
- instance_two->port= port2;
+ ((memcached_server_write_instance_st)instance_one)->port= port0;
+ ((memcached_server_write_instance_st)instance_two)->port= port2;
memcached_quit(memc);
@@ -5563,8 +5367,8 @@
}
memcached_quit(memc);
- instance_one->port= 0;
- instance_two->port= 0;
+ ((memcached_server_write_instance_st)instance_one)->port= 0;
+ ((memcached_server_write_instance_st)instance_two)->port= 0;
/* now retry the command, this time we should have cache misses */
rc= memcached_mget(memc, (const char* const *)keys, key_length, max_keys);
@@ -5583,8 +5387,8 @@
free(key_length);
/* restore the memc handle */
- instance_one->port= port0;
- instance_two->port= port2;
+ ((memcached_server_write_instance_st)instance_one)->port= port0;
+ ((memcached_server_write_instance_st)instance_two)->port= port2;
return TEST_SUCCESS;
}
@@ -5595,8 +5399,8 @@
test_true(memc_clone != NULL);
test_true(memcached_version(memc_clone) == MEMCACHED_SUCCESS);
- memcached_server_instance_st *instance=
- memcached_server_instance_fetch(memc_clone, 0);
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc_clone, 0);
if (instance->major_version > 1 ||
(instance->major_version == 1 &&
@@ -5657,12 +5461,13 @@
static test_return_t test_get_last_disconnect(memcached_st *memc)
{
memcached_return_t rc;
- memcached_server_st *disconnected_server;
+ memcached_server_instance_st disconnected_server;
/* With the working set of server */
const char *key= "marmotte";
const char *value= "milka";
+ memcached_reset_last_disconnected_server(memc);
rc= memcached_set(memc, key, strlen(key),
value, strlen(value),
(time_t)0, (uint32_t)0);
@@ -5690,10 +5495,15 @@
(time_t)0, (uint32_t)0);
test_true(rc != MEMCACHED_SUCCESS);
- disconnected_server = memcached_server_get_last_disconnect(mine);
+ disconnected_server= memcached_server_get_last_disconnect(mine);
+ if (disconnected_server == NULL)
+ {
+ fprintf(stderr, "RC %s\n", memcached_strerror(mine, rc));
+ abort();
+ }
test_true(disconnected_server != NULL);
- test_true(disconnected_server->port == 9);
- test_true(strncmp(disconnected_server->hostname,"localhost",9) == 0);
+ test_true(memcached_server_port(disconnected_server)== 9);
+ test_true(strncmp(memcached_server_name(disconnected_server),"localhost",9) == 0);
memcached_quit(mine);
memcached_free(mine);
@@ -5701,6 +5511,67 @@
return TEST_SUCCESS;
}
+static test_return_t test_verbosity(memcached_st *memc)
+{
+ memcached_verbosity(memc, 3);
+
+ return TEST_SUCCESS;
+}
+
+static test_return_t test_server_failure(memcached_st *memc)
+{
+ memcached_st *local_memc;
+ memcached_server_instance_st instance= memcached_server_instance_by_position(memc, 0);
+
+ local_memc= memcached_create(NULL);
+
+ memcached_server_add(local_memc, memcached_server_name(instance), memcached_server_port(instance));
+ memcached_behavior_set(local_memc, MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT, 2);
+
+ uint32_t server_count= memcached_server_count(local_memc);
+
+ test_true(server_count == 1);
+
+ // Disable the server
+ instance= memcached_server_instance_by_position(local_memc, 0);
+ ((memcached_server_write_instance_st)instance)->server_failure_counter= 2;
+
+ memcached_return_t rc;
+ rc= memcached_set(local_memc, "foo", strlen("foo"),
+ NULL, 0,
+ (time_t)0, (uint32_t)0);
+ test_true(rc == MEMCACHED_SERVER_MARKED_DEAD);
+
+ ((memcached_server_write_instance_st)instance)->server_failure_counter= 0;
+ rc= memcached_set(local_memc, "foo", strlen("foo"),
+ NULL, 0,
+ (time_t)0, (uint32_t)0);
+ test_true(rc == MEMCACHED_SUCCESS);
+
+
+ memcached_free(local_memc);
+
+ return TEST_SUCCESS;
+}
+
+static test_return_t test_cull_servers(memcached_st *memc)
+{
+ uint32_t count = memcached_server_count(memc);
+
+ // Do not do this in your code, it is not supported.
+ memc->servers[1].state.is_dead= true;
+ memc->state.is_time_for_rebuild= true;
+
+ uint32_t new_count= memcached_server_count(memc);
+ test_true(count == new_count);
+
+#if 0
+ test_true(count == new_count + 1 );
+#endif
+
+ return TEST_SUCCESS;
+}
+
/*
* This test ensures that the failure counter isn't incremented during
* normal termination of the memcached instance.
@@ -5708,7 +5579,7 @@
static test_return_t wrong_failure_counter_test(memcached_st *memc)
{
memcached_return_t rc;
- memcached_server_instance_st *instance;
+ memcached_server_instance_st instance;
/* Set value to force connection to the server */
const char *key= "marmotte";
@@ -5729,12 +5600,12 @@
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
- instance= memcached_server_instance_fetch(memc, 0);
+ instance= memcached_server_instance_by_position(memc, 0);
/* The test is to see that the memcached_quit doesn't increase the
* the server failure conter, so let's ensure that it is zero
* before sending quit
*/
- instance->server_failure_counter= 0;
+ ((memcached_server_write_instance_st)instance)->server_failure_counter= 0;
memcached_quit(memc);
@@ -5764,6 +5635,10 @@
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT, 1);
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_RETRY_TIMEOUT, 3600);
+#ifdef __APPLE__
+ return TEST_SKIPPED; // My MAC can't handle this test
+#endif
+
/*
* I only want to hit _one_ server so I know the number of requests I'm
* sending in the pipeline.
@@ -5777,6 +5652,7 @@
size_t *key_length=calloc(max_keys, sizeof(size_t));
/* First add all of the items.. */
+ bool slept= false;
char blob[1024]= { 0 };
memcached_return rc;
for (size_t x= 0; x < max_keys; ++x)
@@ -5786,38 +5662,60 @@
keys[x]= strdup(k);
assert(keys[x] != NULL);
rc= memcached_set(memc, keys[x], key_length[x], blob, sizeof(blob), 0, 0);
- assert(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
+#ifdef __APPLE__
+ if (rc == MEMCACHED_SERVER_MARKED_DEAD)
+ {
+ break; // We are out of business
+ }
+#endif
+ test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED || rc == MEMCACHED_TIMEOUT); // MEMCACHED_TIMEOUT <-- only observed on OSX
+
+ if (rc == MEMCACHED_TIMEOUT && slept == false)
+ {
+ x++;
+ sleep(1);// We will try to sleep
+ slept= true;
+ }
+ else if (rc == MEMCACHED_TIMEOUT && slept == true)
+ {
+ // We failed to send everything.
+ break;
+ }
}
- /* Try to get all of them with a large multiget */
- size_t counter= 0;
- memcached_execute_function callbacks[1]= { [0]= &callback_counter };
- rc= memcached_mget_execute(memc, (const char**)keys, key_length,
- (size_t)max_keys, callbacks, &counter, 1);
+ if (rc != MEMCACHED_SERVER_MARKED_DEAD)
+ {
- assert(rc == MEMCACHED_SUCCESS);
- char* the_value= NULL;
- char the_key[MEMCACHED_MAX_KEY];
- size_t the_key_length;
- size_t the_value_length;
- uint32_t the_flags;
+ /* Try to get all of them with a large multiget */
+ size_t counter= 0;
+ memcached_execute_function callbacks[1]= { [0]= &callback_counter };
+ rc= memcached_mget_execute(memc, (const char**)keys, key_length,
+ (size_t)max_keys, callbacks, &counter, 1);
+
+ assert(rc == MEMCACHED_SUCCESS);
+ char* the_value= NULL;
+ char the_key[MEMCACHED_MAX_KEY];
+ size_t the_key_length;
+ size_t the_value_length;
+ uint32_t the_flags;
- do {
- the_value= memcached_fetch(memc, the_key, &the_key_length, &the_value_length, &the_flags, &rc);
+ do {
+ the_value= memcached_fetch(memc, the_key, &the_key_length, &the_value_length, &the_flags, &rc);
- if ((the_value!= NULL) && (rc == MEMCACHED_SUCCESS))
- {
- ++counter;
- free(the_value);
- }
+ if ((the_value!= NULL) && (rc == MEMCACHED_SUCCESS))
+ {
+ ++counter;
+ free(the_value);
+ }
- } while ( (the_value!= NULL) && (rc == MEMCACHED_SUCCESS));
+ } while ( (the_value!= NULL) && (rc == MEMCACHED_SUCCESS));
- assert(rc == MEMCACHED_END);
+ assert(rc == MEMCACHED_END);
- /* Verify that we got all of the items */
- assert(counter == max_keys);
+ /* Verify that we got all of the items */
+ assert(counter == max_keys);
+ }
/* Release all allocated resources */
for (size_t x= 0; x < max_keys; ++x)
@@ -5832,33 +5730,149 @@
return TEST_SUCCESS;
}
+static void memcached_die(memcached_st* mc, memcached_return error, const char* what, uint32_t it)
+{
+ fprintf(stderr, "Iteration #%u: ", it);
+ if(error == MEMCACHED_ERRNO)
+ {
+ fprintf(stderr, "system error %d from %s: %s\n",
+ errno, what, strerror(errno));
+ }
+ else
+ {
+ fprintf(stderr, "error %d from %s: %s\n", error, what,
+ memcached_strerror(mc, error));
+ }
+}
+#define TEST_CONSTANT_CREATION 200
-test_st udp_setup_server_tests[] ={
- {"set_udp_behavior_test", 0, (test_callback_fn)set_udp_behavior_test},
- {"add_tcp_server_udp_client_test", 0, (test_callback_fn)add_tcp_server_udp_client_test},
- {"add_udp_server_tcp_client_test", 0, (test_callback_fn)add_udp_server_tcp_client_test},
- {0, 0, 0}
-};
+static test_return_t regression_bug_(memcached_st *memc)
+{
+ const char *remote_server;
+ (void)memc;
-test_st upd_io_tests[] ={
- {"udp_set_test", 0, (test_callback_fn)udp_set_test},
- {"udp_buffered_set_test", 0, (test_callback_fn)udp_buffered_set_test},
- {"udp_set_too_big_test", 0, (test_callback_fn)udp_set_too_big_test},
- {"udp_delete_test", 0, (test_callback_fn)udp_delete_test},
- {"udp_buffered_delete_test", 0, (test_callback_fn)udp_buffered_delete_test},
- {"udp_verbosity_test", 0, (test_callback_fn)udp_verbosity_test},
- {"udp_quit_test", 0, (test_callback_fn)udp_quit_test},
- {"udp_flush_test", 0, (test_callback_fn)udp_flush_test},
- {"udp_incr_test", 0, (test_callback_fn)udp_incr_test},
- {"udp_decr_test", 0, (test_callback_fn)udp_decr_test},
- {"udp_stat_test", 0, (test_callback_fn)udp_stat_test},
- {"udp_version_test", 0, (test_callback_fn)udp_version_test},
- {"udp_get_test", 0, (test_callback_fn)udp_get_test},
- {"udp_mixed_io_test", 0, (test_callback_fn)udp_mixed_io_test},
- {0, 0, 0}
-};
+ if (! (remote_server= getenv("LIBMEMCACHED_REMOTE_SERVER")))
+ {
+ return TEST_SKIPPED;
+ }
+
+ for (uint32_t x= 0; x < TEST_CONSTANT_CREATION; x++)
+ {
+ memcached_st* mc= memcached_create(NULL);
+ memcached_return rc;
+
+ rc= memcached_behavior_set(mc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1);
+ if (rc != MEMCACHED_SUCCESS)
+ {
+ memcached_die(mc, rc, "memcached_behavior_set", x);
+ }
+
+ rc= memcached_behavior_set(mc, MEMCACHED_BEHAVIOR_CACHE_LOOKUPS, 1);
+ if (rc != MEMCACHED_SUCCESS)
+ {
+ memcached_die(mc, rc, "memcached_behavior_set", x);
+ }
+
+ rc= memcached_server_add(mc, remote_server, 0);
+ if (rc != MEMCACHED_SUCCESS)
+ {
+ memcached_die(mc, rc, "memcached_server_add", x);
+ }
+
+ const char *set_key= "akey";
+ const size_t set_key_len= strlen(set_key);
+ const char *set_value= "a value";
+ const size_t set_value_len= strlen(set_value);
+
+ if (rc == MEMCACHED_SUCCESS)
+ {
+ if (x > 0)
+ {
+ size_t get_value_len;
+ char *get_value;
+ uint32_t get_value_flags;
+
+ get_value= memcached_get(mc, set_key, set_key_len, &get_value_len,
+ &get_value_flags, &rc);
+ if (rc != MEMCACHED_SUCCESS)
+ {
+ memcached_die(mc, rc, "memcached_get", x);
+ }
+ else
+ {
+
+ if (x != 0 &&
+ (get_value_len != set_value_len
+ || 0!=strncmp(get_value, set_value, get_value_len)))
+ {
+ fprintf(stderr, "Values don't match?\n");
+ rc= MEMCACHED_FAILURE;
+ }
+ free(get_value);
+ }
+ }
+
+ rc= memcached_set(mc,
+ set_key, set_key_len,
+ set_value, set_value_len,
+ 0, /* time */
+ 0 /* flags */
+ );
+ if (rc != MEMCACHED_SUCCESS)
+ {
+ memcached_die(mc, rc, "memcached_set", x);
+ }
+ }
+
+ memcached_quit(mc);
+ memcached_free(mc);
+
+ if (rc != MEMCACHED_SUCCESS)
+ {
+ break;
+ }
+ }
+
+ return TEST_SUCCESS;
+}
+
+/*
+ * Test that the sasl authentication works. We cannot use the default
+ * pool of servers, because that would require that all servers we want
+ * to test supports SASL authentication, and that they use the default
+ * creds.
+ */
+static test_return_t sasl_auth_test(memcached_st *memc)
+{
+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+ memcached_return_t rc;
+
+ rc= memcached_set(memc, "foo", 3, "bar", 3, (time_t)0, (uint32_t)0);
+ test_true(rc == MEMCACHED_SUCCESS);
+ test_true((rc= memcached_delete(memc, "foo", 3, 0)) == MEMCACHED_SUCCESS);
+ test_true((rc= memcached_destroy_sasl_auth_data(memc)) == MEMCACHED_SUCCESS);
+ test_true((rc= memcached_destroy_sasl_auth_data(memc)) == MEMCACHED_FAILURE);
+ test_true((rc= memcached_destroy_sasl_auth_data(NULL)) == MEMCACHED_FAILURE);
+ memcached_quit(memc);
+
+ rc= memcached_set_sasl_auth_data(memc,
+ getenv("LIBMEMCACHED_TEST_SASL_USERNAME"),
+ getenv("LIBMEMCACHED_TEST_SASL_SERVER"));
+ test_true(rc == MEMCACHED_SUCCESS);
+
+ rc= memcached_set(memc, "foo", 3, "bar", 3, (time_t)0, (uint32_t)0);
+ test_true(rc == MEMCACHED_AUTH_FAILURE);
+ test_true(memcached_destroy_sasl_auth_data(memc) == MEMCACHED_SUCCESS);
+
+ memcached_quit(memc);
+ return TEST_SUCCESS;
+#else
+ (void)memc;
+ return TEST_FAILURE;
+#endif
+}
/* Clean the server before beginning testing */
test_st tests[] ={
@@ -5869,6 +5883,7 @@
{"server_unsort", 0, (test_callback_fn)server_unsort_test},
{"server_sort", 0, (test_callback_fn)server_sort_test},
{"server_sort2", 0, (test_callback_fn)server_sort2_test},
+ {"memcached_server_remove", 0, (test_callback_fn)memcached_server_remove_test},
{"clone_test", 0, (test_callback_fn)clone_test },
{"connection_test", 0, (test_callback_fn)connection_test},
{"callback_test", 0, (test_callback_fn)callback_test},
@@ -5917,12 +5932,23 @@
{"connectionpool", 1, (test_callback_fn)connection_pool_test },
#endif
{"test_get_last_disconnect", 1, (test_callback_fn)test_get_last_disconnect},
+ {"verbosity", 1, (test_callback_fn)test_verbosity},
+ {"test_server_failure", 1, (test_callback_fn)test_server_failure},
+ {"cull_servers", 1, (test_callback_fn)test_cull_servers},
{0, 0, 0}
};
test_st behavior_tests[] ={
{"behavior_test", 0, (test_callback_fn)behavior_test},
{"MEMCACHED_BEHAVIOR_CORK", 0, (test_callback_fn)MEMCACHED_BEHAVIOR_CORK_test},
+ {"MEMCACHED_BEHAVIOR_TCP_KEEPALIVE", 0, (test_callback_fn)MEMCACHED_BEHAVIOR_TCP_KEEPALIVE_test},
+ {"MEMCACHED_BEHAVIOR_TCP_KEEPIDLE", 0, (test_callback_fn)MEMCACHED_BEHAVIOR_TCP_KEEPIDLE_test},
+ {0, 0, 0}
+};
+
+test_st regression_binary_vs_block[] ={
+ {"block add", 1, (test_callback_fn)block_add_regression},
+ {"binary add", 1, (test_callback_fn)binary_add_regression},
{0, 0, 0}
};
@@ -6009,12 +6035,18 @@
test_st regression_tests[]= {
{"lp:434484", 1, (test_callback_fn)regression_bug_434484 },
{"lp:434843", 1, (test_callback_fn)regression_bug_434843 },
- {"lp:434843 buffered", 1, (test_callback_fn)regression_bug_434843_buffered },
+ {"lp:434843-buffered", 1, (test_callback_fn)regression_bug_434843_buffered },
{"lp:421108", 1, (test_callback_fn)regression_bug_421108 },
{"lp:442914", 1, (test_callback_fn)regression_bug_442914 },
{"lp:447342", 1, (test_callback_fn)regression_bug_447342 },
{"lp:463297", 1, (test_callback_fn)regression_bug_463297 },
{"lp:490486", 1, (test_callback_fn)regression_bug_490486 },
+ {"lp:?", 1, (test_callback_fn)regression_bug_ },
+ {0, 0, (test_callback_fn)0}
+};
+
+test_st sasl_auth_tests[]= {
+ {"sasl_auth", 1, (test_callback_fn)sasl_auth_test },
{0, 0, (test_callback_fn)0}
};
@@ -6097,9 +6129,6 @@
{"hash_sanity", 0, 0, hash_sanity},
#endif
{"hsieh_availability", 0, 0, hsieh_availability},
- {"udp_setup", (test_callback_fn)init_udp, 0, udp_setup_server_tests},
- {"udp_io", (test_callback_fn)init_udp, 0, upd_io_tests},
- {"udp_binary_io", (test_callback_fn)binary_init_udp, 0, upd_io_tests},
{"block", 0, 0, tests},
{"binary", (test_callback_fn)pre_binary, 0, tests},
{"nonblock", (test_callback_fn)pre_nonblock, 0, tests},
@@ -6126,6 +6155,8 @@
#endif
{"memory_allocators", (test_callback_fn)set_memory_alloc, 0, tests},
{"prefix", (test_callback_fn)set_prefix, 0, tests},
+ {"sasl_auth", (test_callback_fn)pre_sasl, 0, sasl_auth_tests },
+ {"sasl", (test_callback_fn)pre_sasl, 0, tests },
{"version_1_2_3", (test_callback_fn)check_for_1_2_3, 0, version_1_2_3},
{"string", 0, 0, string_tests},
{"result", 0, 0, result_tests},
@@ -6152,6 +6183,7 @@
{"replication_noblock", (test_callback_fn)pre_replication_noblock, 0, replication_tests},
{"regression", 0, 0, regression_tests},
{"behaviors", 0, 0, behavior_tests},
+ {"regression_binary_vs_block", (test_callback_fn)key_setup, (test_callback_fn)key_teardown, regression_binary_vs_block},
{0, 0, 0, 0}
};
|
[-]
[+]
|
Added |
libmemcached-0.40.tar.bz2/tests/mem_udp.c
^
|
@@ -0,0 +1,514 @@
+/* libMemcached Functions Test
+ * Copyright (C) 2006-2009 Brian Aker
+ * All rights reserved.
+ *
+ * Use and distribution licensed under the BSD license. See
+ * the COPYING file in the parent directory for full text.
+ */
+
+/*
+ Sample test application.
+*/
+
+#include "libmemcached/common.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <signal.h>
+#include <unistd.h>
+#include <time.h>
+
+#include "server.h"
+
+#ifndef INT64_MAX
+#define INT64_MAX LONG_MAX
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX INT_MAX
+#endif
+
+
+#include "test.h"
+
+#define SERVERS_TO_CREATE 5
+
+
+/**
+ @note This should be testing to see if the server really supports the binary protocol.
+*/
+static test_return_t pre_binary(memcached_st *memc)
+{
+ memcached_return_t rc= MEMCACHED_FAILURE;
+ memcached_st *memc_clone;
+ memcached_server_instance_st instance;
+
+ memc_clone= memcached_clone(NULL, memc);
+ test_true(memc_clone);
+ // The memcached_version needs to be done on a clone, because the server
+ // will not toggle protocol on an connection.
+ memcached_version(memc_clone);
+
+ instance= memcached_server_instance_by_position(memc_clone, 0);
+
+ if (instance->major_version >= 1 && instance->minor_version > 2)
+ {
+ rc = memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1);
+ test_true(rc == MEMCACHED_SUCCESS);
+ test_true(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == 1);
+ }
+
+ memcached_free(memc_clone);
+
+ return rc == MEMCACHED_SUCCESS ? TEST_SUCCESS : TEST_SKIPPED;
+}
+
+static void increment_request_id(uint16_t *id)
+{
+ (*id)++;
+ if ((*id & UDP_REQUEST_ID_THREAD_MASK) != 0)
+ *id= 0;
+}
+
+static uint16_t *get_udp_request_ids(memcached_st *memc)
+{
+ uint16_t *ids= malloc(sizeof(uint16_t) * memcached_server_count(memc));
+ assert(ids != NULL);
+
+ for (uint32_t x= 0; x < memcached_server_count(memc); x++)
+ {
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, x);
+
+ ids[x]= get_udp_datagram_request_id((struct udp_datagram_header_st *) ((memcached_server_instance_st )instance)->write_buffer);
+ }
+
+ return ids;
+}
+
+static test_return_t post_udp_op_check(memcached_st *memc, uint16_t *expected_req_ids)
+{
+ (void)memc;
+ (void)expected_req_ids;
+#if 0
+ memcached_server_st *cur_server = memcached_server_list(memc);
+ uint16_t *cur_req_ids = get_udp_request_ids(memc);
+
+ for (size_t x= 0; x < memcached_server_count(memc); x++)
+ {
+ test_true(cur_server[x].cursor_active == 0);
+ test_true(cur_req_ids[x] == expected_req_ids[x]);
+ }
+ free(expected_req_ids);
+ free(cur_req_ids);
+
+#endif
+ return TEST_SUCCESS;
+}
+
+/*
+** There is a little bit of a hack here, instead of removing
+** the servers, I just set num host to 0 and them add then new udp servers
+**/
+static test_return_t init_udp(memcached_st *memc)
+{
+ memcached_version(memc);
+#if 0
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, 0);
+
+ /* For the time being, only support udp test for >= 1.2.6 && < 1.3 */
+ if (instance->major_version != 1 || instance->minor_version != 2
+ || instance->micro_version < 6)
+ return TEST_SKIPPED;
+
+ uint32_t num_hosts= memcached_server_count(memc);
+ memcached_server_st servers[num_hosts];
+ memcpy(servers, memcached_server_list(memc), sizeof(memcached_server_st) * num_hosts);
+ for (uint32_t x= 0; x < num_hosts; x++)
+ {
+ memcached_server_instance_st set_instance=
+ memcached_server_instance_by_position(memc, x);
+
+ memcached_server_free(((memcached_server_write_instance_st)set_instance));
+ }
+
+ memc->number_of_hosts= 0;
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_USE_UDP, 1);
+ for (uint32_t x= 0; x < num_hosts; x++)
+ {
+ memcached_server_instance_st set_instance=
+ memcached_server_instance_by_position(memc, x);
+
+ test_true(memcached_server_add_udp(memc, servers[x].hostname, servers[x].port) == MEMCACHED_SUCCESS);
+ test_true(set_instance->write_buffer_offset == UDP_DATAGRAM_HEADER_LENGTH);
+ }
+#endif
+
+ return TEST_SKIPPED;
+}
+
+static test_return_t binary_init_udp(memcached_st *memc)
+{
+ test_return_t test_rc;
+ test_rc= pre_binary(memc);
+
+ if (test_rc != TEST_SUCCESS)
+ return test_rc;
+
+ return init_udp(memc);
+}
+
+/* Make sure that I cant add a tcp server to a udp client */
+static test_return_t add_tcp_server_udp_client_test(memcached_st *memc)
+{
+ (void)memc;
+#if 0
+ memcached_server_st server;
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, 0);
+ memcached_server_clone(&server, &memc->hosts[0]);
+ test_true(memcached_server_remove(&(memc->hosts[0])) == MEMCACHED_SUCCESS);
+ test_true(memcached_server_add(memc, server.hostname, server.port) == MEMCACHED_INVALID_HOST_PROTOCOL);
+#endif
+ return TEST_SUCCESS;
+}
+
+/* Make sure that I cant add a udp server to a tcp client */
+static test_return_t add_udp_server_tcp_client_test(memcached_st *memc)
+{
+ (void)memc;
+#if 0
+ memcached_server_st server;
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, 0);
+ memcached_server_clone(&server, &memc->hosts[0]);
+ test_true(memcached_server_remove(&(memc->hosts[0])) == MEMCACHED_SUCCESS);
+
+ memcached_st tcp_client;
+ memcached_create(&tcp_client);
+ test_true(memcached_server_add_udp(&tcp_client, server.hostname, server.port) == MEMCACHED_INVALID_HOST_PROTOCOL);
+#endif
+
+ return TEST_SUCCESS;
+}
+
+static test_return_t set_udp_behavior_test(memcached_st *memc)
+{
+
+ memcached_quit(memc);
+ memc->number_of_hosts= 0;
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, memc->distribution);
+ test_true(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_USE_UDP, 1) == MEMCACHED_SUCCESS);
+ test_true(memc->flags.use_udp);
+ test_true(memc->flags.no_reply);
+
+ test_true(memcached_server_count(memc) == 0);
+
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_USE_UDP,0);
+ test_true(! (memc->flags.use_udp));
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NOREPLY,0);
+ test_true(! (memc->flags.no_reply));
+
+ return TEST_SUCCESS;
+}
+
+static test_return_t udp_set_test(memcached_st *memc)
+{
+ unsigned int num_iters= 1025; //request id rolls over at 1024
+
+ for (size_t x= 0; x < num_iters;x++)
+ {
+ memcached_return_t rc;
+ const char *key= "foo";
+ const char *value= "when we sanitize";
+ uint16_t *expected_ids= get_udp_request_ids(memc);
+ unsigned int server_key= memcached_generate_hash(memc, key, strlen(key));
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, server_key);
+ size_t init_offset= instance->write_buffer_offset;
+
+ rc= memcached_set(memc, key, strlen(key),
+ value, strlen(value),
+ (time_t)0, (uint32_t)0);
+ test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
+ /** NB, the check below assumes that if new write_ptr is less than
+ * the original write_ptr that we have flushed. For large payloads, this
+ * maybe an invalid assumption, but for the small payload we have it is OK
+ */
+ if (rc == MEMCACHED_SUCCESS ||
+ instance->write_buffer_offset < init_offset)
+ increment_request_id(&expected_ids[server_key]);
+
+ if (rc == MEMCACHED_SUCCESS)
+ {
+ test_true(instance->write_buffer_offset == UDP_DATAGRAM_HEADER_LENGTH);
+ }
+ else
+ {
+ test_true(instance->write_buffer_offset != UDP_DATAGRAM_HEADER_LENGTH);
+ test_true(instance->write_buffer_offset <= MAX_UDP_DATAGRAM_LENGTH);
+ }
+ test_true(post_udp_op_check(memc, expected_ids) == TEST_SUCCESS);
+ }
+ return TEST_SUCCESS;
+}
+
+static test_return_t udp_buffered_set_test(memcached_st *memc)
+{
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 1);
+ return udp_set_test(memc);
+}
+
+static test_return_t udp_set_too_big_test(memcached_st *memc)
+{
+ memcached_return_t rc;
+ const char *key= "bar";
+ char value[MAX_UDP_DATAGRAM_LENGTH];
+ uint16_t *expected_ids= get_udp_request_ids(memc);
+ rc= memcached_set(memc, key, strlen(key),
+ value, MAX_UDP_DATAGRAM_LENGTH,
+ (time_t)0, (uint32_t)0);
+ test_true(rc == MEMCACHED_WRITE_FAILURE);
+
+ return post_udp_op_check(memc,expected_ids);
+}
+
+static test_return_t udp_delete_test(memcached_st *memc)
+{
+ unsigned int num_iters= 1025; //request id rolls over at 1024
+
+ for (size_t x= 0; x < num_iters;x++)
+ {
+ memcached_return_t rc;
+ const char *key= "foo";
+ uint16_t *expected_ids=get_udp_request_ids(memc);
+ unsigned int server_key= memcached_generate_hash(memc, key, strlen(key));
+ memcached_server_instance_st instance=
+ memcached_server_instance_by_position(memc, server_key);
+ size_t init_offset= instance->write_buffer_offset;
+
+ rc= memcached_delete(memc, key, strlen(key), 0);
+ test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
+
+ if (rc == MEMCACHED_SUCCESS || instance->write_buffer_offset < init_offset)
+ increment_request_id(&expected_ids[server_key]);
+ if (rc == MEMCACHED_SUCCESS)
+ {
+ test_true(instance->write_buffer_offset == UDP_DATAGRAM_HEADER_LENGTH);
+ }
+ else
+ {
+ test_true(instance->write_buffer_offset != UDP_DATAGRAM_HEADER_LENGTH);
+ test_true(instance->write_buffer_offset <= MAX_UDP_DATAGRAM_LENGTH);
+ }
+ test_true(post_udp_op_check(memc,expected_ids) == TEST_SUCCESS);
+ }
+ return TEST_SUCCESS;
+}
+
+static test_return_t udp_buffered_delete_test(memcached_st *memc)
+{
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 1);
+ return udp_delete_test(memc);
+}
+
+static test_return_t udp_verbosity_test(memcached_st *memc)
+{
+ memcached_return_t rc;
+ uint16_t *expected_ids= get_udp_request_ids(memc);
+
+ for (size_t x= 0; x < memcached_server_count(memc); x++)
+ {
+ increment_request_id(&expected_ids[x]);
+ }
+
+ rc= memcached_verbosity(memc,3);
+ test_true(rc == MEMCACHED_SUCCESS);
+ return post_udp_op_check(memc,expected_ids);
+}
+
+static test_return_t udp_quit_test(memcached_st *memc)
+{
+ uint16_t *expected_ids= get_udp_request_ids(memc);
+ memcached_quit(memc);
+ return post_udp_op_check(memc, expected_ids);
+}
+
+static test_return_t udp_flush_test(memcached_st *memc)
+{
+ memcached_return_t rc;
+ uint16_t *expected_ids= get_udp_request_ids(memc);
+
+ for (size_t x= 0; x < memcached_server_count(memc); x++)
+ {
+ increment_request_id(&expected_ids[x]);
+ }
+
+ rc= memcached_flush(memc,0);
+ test_true(rc == MEMCACHED_SUCCESS);
+ return post_udp_op_check(memc,expected_ids);
+}
+
+static test_return_t udp_incr_test(memcached_st *memc)
+{
+ memcached_return_t rc;
+ const char *key= "incr";
+ const char *value= "1";
+ rc= memcached_set(memc, key, strlen(key),
+ value, strlen(value),
+ (time_t)0, (uint32_t)0);
+
+ test_true(rc == MEMCACHED_SUCCESS);
+ uint16_t *expected_ids= get_udp_request_ids(memc);
+ unsigned int server_key= memcached_generate_hash(memc, key, strlen(key));
+ increment_request_id(&expected_ids[server_key]);
+ uint64_t newvalue;
+ rc= memcached_increment(memc, key, strlen(key), 1, &newvalue);
+ test_true(rc == MEMCACHED_SUCCESS);
+ return post_udp_op_check(memc, expected_ids);
+}
+
+static test_return_t udp_decr_test(memcached_st *memc)
+{
+ memcached_return_t rc;
+ const char *key= "decr";
+ const char *value= "1";
+ rc= memcached_set(memc, key, strlen(key),
+ value, strlen(value),
+ (time_t)0, (uint32_t)0);
+
+ test_true(rc == MEMCACHED_SUCCESS);
+ uint16_t *expected_ids= get_udp_request_ids(memc);
+ unsigned int server_key= memcached_generate_hash(memc, key, strlen(key));
+ increment_request_id(&expected_ids[server_key]);
+ uint64_t newvalue;
+ rc= memcached_decrement(memc, key, strlen(key), 1, &newvalue);
+ test_true(rc == MEMCACHED_SUCCESS);
+ return post_udp_op_check(memc, expected_ids);
+}
+
+
+static test_return_t udp_stat_test(memcached_st *memc)
+{
+ memcached_stat_st * rv= NULL;
+ memcached_return_t rc;
+ char args[]= "";
+ uint16_t *expected_ids = get_udp_request_ids(memc);
+ rv = memcached_stat(memc, args, &rc);
+ free(rv);
+ test_true(rc == MEMCACHED_NOT_SUPPORTED);
+ return post_udp_op_check(memc, expected_ids);
+}
+
+static test_return_t udp_version_test(memcached_st *memc)
+{
+ memcached_return_t rc;
+ uint16_t *expected_ids = get_udp_request_ids(memc);
+ rc = memcached_version(memc);
+ test_true(rc == MEMCACHED_NOT_SUPPORTED);
+ return post_udp_op_check(memc, expected_ids);
+}
+
+static test_return_t udp_get_test(memcached_st *memc)
+{
+ memcached_return_t rc;
+ const char *key= "foo";
+ size_t vlen;
+ uint16_t *expected_ids = get_udp_request_ids(memc);
+ char *val= memcached_get(memc, key, strlen(key), &vlen, (uint32_t)0, &rc);
+ test_true(rc == MEMCACHED_NOT_SUPPORTED);
+ test_true(val == NULL);
+ return post_udp_op_check(memc, expected_ids);
+}
+
+static test_return_t udp_mixed_io_test(memcached_st *memc)
+{
+ test_st current_op;
+ test_st mixed_io_ops [] ={
+ {"udp_set_test", 0,
+ (test_callback_fn)udp_set_test},
+ {"udp_set_too_big_test", 0,
+ (test_callback_fn)udp_set_too_big_test},
+ {"udp_delete_test", 0,
+ (test_callback_fn)udp_delete_test},
+ {"udp_verbosity_test", 0,
+ (test_callback_fn)udp_verbosity_test},
+ {"udp_quit_test", 0,
+ (test_callback_fn)udp_quit_test},
+ {"udp_flush_test", 0,
+ (test_callback_fn)udp_flush_test},
+ {"udp_incr_test", 0,
+ (test_callback_fn)udp_incr_test},
+ {"udp_decr_test", 0,
+ (test_callback_fn)udp_decr_test},
+ {"udp_version_test", 0,
+ (test_callback_fn)udp_version_test}
+ };
+
+ for (size_t x= 0; x < 500; x++)
+ {
+ current_op= mixed_io_ops[random() % 9];
+ test_true(current_op.test_fn(memc) == TEST_SUCCESS);
+ }
+ return TEST_SUCCESS;
+}
+
+test_st udp_setup_server_tests[] ={
+ {"set_udp_behavior_test", 0, (test_callback_fn)set_udp_behavior_test},
+ {"add_tcp_server_udp_client_test", 0, (test_callback_fn)add_tcp_server_udp_client_test},
+ {"add_udp_server_tcp_client_test", 0, (test_callback_fn)add_udp_server_tcp_client_test},
+ {0, 0, 0}
+};
+
+test_st upd_io_tests[] ={
+ {"udp_set_test", 0, (test_callback_fn)udp_set_test},
+ {"udp_buffered_set_test", 0, (test_callback_fn)udp_buffered_set_test},
+ {"udp_set_too_big_test", 0, (test_callback_fn)udp_set_too_big_test},
+ {"udp_delete_test", 0, (test_callback_fn)udp_delete_test},
+ {"udp_buffered_delete_test", 0, (test_callback_fn)udp_buffered_delete_test},
+ {"udp_verbosity_test", 0, (test_callback_fn)udp_verbosity_test},
+ {"udp_quit_test", 0, (test_callback_fn)udp_quit_test},
+ {"udp_flush_test", 0, (test_callback_fn)udp_flush_test},
+ {"udp_incr_test", 0, (test_callback_fn)udp_incr_test},
+ {"udp_decr_test", 0, (test_callback_fn)udp_decr_test},
+ {"udp_stat_test", 0, (test_callback_fn)udp_stat_test},
+ {"udp_version_test", 0, (test_callback_fn)udp_version_test},
+ {"udp_get_test", 0, (test_callback_fn)udp_get_test},
+ {"udp_mixed_io_test", 0, (test_callback_fn)udp_mixed_io_test},
+ {0, 0, 0}
+};
+
+collection_st collection[] ={
+ {"udp_setup", (test_callback_fn)init_udp, 0, udp_setup_server_tests},
+ {"udp_io", (test_callback_fn)init_udp, 0, upd_io_tests},
+ {"udp_binary_io", (test_callback_fn)binary_init_udp, 0, upd_io_tests},
+ {0, 0, 0, 0}
+};
+
+#define SERVERS_TO_CREATE 5
+
+#include "libmemcached_world.h"
+
+void get_world(world_st *world)
+{
+ world->collections= collection;
+
+ world->create= (test_callback_create_fn)world_create;
+ world->destroy= (test_callback_fn)world_destroy;
+
+ world->test.startup= (test_callback_fn)world_test_startup;
+ world->test.flush= (test_callback_fn)world_flush;
+ world->test.pre_run= (test_callback_fn)world_pre_run;
+ world->test.post_run= (test_callback_fn)world_post_run;
+ world->test.on_error= (test_callback_error_fn)world_on_error;
+
+ world->collection.startup= (test_callback_fn)world_container_startup;
+ world->collection.shutdown= (test_callback_fn)world_container_shutdown;
+
+ world->runner= &defualt_libmemcached_runner;
+}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/tests/server.c
^
|
@@ -13,7 +13,7 @@
Startup, and shutdown the memcached servers.
*/
-#define TEST_PORT_BASE MEMCACHED_DEFAULT_PORT+10
+#define TEST_PORT_BASE MEMCACHED_DEFAULT_PORT+10
#include "config.h"
@@ -52,7 +52,7 @@
int status;
sprintf(buffer, "/tmp/%umemc.pid", x);
- if (access(buffer, F_OK) == 0)
+ if (access(buffer, F_OK) == 0)
{
FILE *fp= fopen(buffer, "r");
remove(buffer);
@@ -60,9 +60,9 @@
if (fp != NULL)
{
if (fgets(buffer, sizeof(buffer), fp) != NULL)
- {
+ {
pid_t pid= (pid_t)atoi(buffer);
- if (pid != 0)
+ if (pid != 0)
kill(pid, SIGTERM);
}
@@ -74,7 +74,7 @@
{
sprintf(buffer, "%s -d -P /tmp/%umemc.pid -t 1 -p %u -U %u -m 128",
MEMCACHED_BINARY, x, x + TEST_PORT_BASE, x + TEST_PORT_BASE);
- }
+ }
else
{
sprintf(buffer, "%s -d -P /tmp/%umemc.pid -t 1 -p %u -U %u",
@@ -99,7 +99,7 @@
for (x= 0; x < memcached_server_list_count(construct->servers); x++)
{
- printf("\t%s : %d\n", construct->servers[x].hostname, construct->servers[x].port);
+ printf("\t%s : %d\n", memcached_server_name(&construct->servers[x]), memcached_server_port(&construct->servers[x]));
assert(construct->servers[x].fd == -1);
assert(construct->servers[x].cursor_active == 0);
}
@@ -119,7 +119,7 @@
sprintf(buffer, "cat /tmp/%umemc.pid | xargs kill", x);
/* We have to check the return value of this or the compiler will yell */
int sys_ret= system(buffer);
- assert(sys_ret != -1);
+ assert(sys_ret != -1);
sprintf(buffer, "/tmp/%umemc.pid", x);
unlink(buffer);
}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/tests/test.c
^
|
@@ -21,6 +21,7 @@
#include <fnmatch.h>
#include <stdint.h>
+#include "libmemcached/memcached.h"
#include "test.h"
static void world_stats_print(world_stats_st *stats)
@@ -37,7 +38,7 @@
fprintf(stderr, "\tSucceeded\t\t%u\n", stats->success);
}
-static long int timedif(struct timeval a, struct timeval b)
+long int timedif(struct timeval a, struct timeval b)
{
long us, s;
@@ -147,6 +148,14 @@
world_stats_st stats;
+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+ if (sasl_client_init(NULL) != SASL_OK)
+ {
+ fprintf(stderr, "Failed to initialize sasl library!\n");
+ return 1;
+ }
+#endif
+
memset(&stats, 0, sizeof(stats));
memset(&world, 0, sizeof(world));
get_world(&world);
@@ -350,5 +359,9 @@
world_stats_print(&stats);
+#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
+ sasl_done();
+#endif
+
return stats.failed == 0 ? 0 : 1;
}
|
[-]
[+]
|
Changed |
libmemcached-0.40.tar.bz2/tests/test.h
^
|
@@ -39,6 +39,8 @@
typedef test_return_t (*test_callback_runner_fn)(test_callback_fn, void *);
typedef test_return_t (*test_callback_error_fn)(test_return_t, void *);
+/* Help function for use with gettimeofday() */
+long int timedif(struct timeval a, struct timeval b);
/**
A structure describing the test case.
|