Permalink
Browse files

Fixed the Memcached addon

  • Loading branch information...
jcowgar committed Jul 30, 2011
1 parent 2f75a4c commit 098921f8625a2da81df24e2142ef5a4c2acb8078
Showing with 10 additions and 5 deletions.
  1. +1 −1 addons/CMakeLists.txt
  2. +9 −4 addons/Memcached/source/IoMemcached.c
View
@@ -75,7 +75,7 @@ add_subdirectory(Libxml2)
add_subdirectory(Loki)
add_subdirectory(Loudmouth)
add_subdirectory(MD5)
-#add_subdirectory(Memcached)
+add_subdirectory(Memcached)
add_subdirectory(MySQL)
#add_subdirectory(NetworkAdapter)
add_subdirectory(NotificationCenter)
@@ -88,8 +88,13 @@ IoObject *IoMemcached_new(void *state)
void IoMemcached_free(IoMemcached *self)
{
- memcached_free(DATA(self)->mc);
- free(DATA(self));
+ if (DATA(self) != NULL) {
+ if (DATA(self)->mc != NULL) {
+ memcached_free(DATA(self)->mc);
+ }
+
+ free(DATA(self));
+ }
}
/*doc Memcached addServer(address)
@@ -467,8 +472,8 @@ IoObject *IoMemcached_stats(IoMemcached *self, IoObject *locals, IoMessage *m)
IoMap *results_map = IoMap_new(IOSTATE);
int i;
- for(i = 0; i < memcached_server_list_count(DATA(self)->mc->hosts); i++) {
- memcached_server_st *server = DATA(self)->mc->hosts + i;
+ for(i = 0; i < memcached_server_list_count(DATA(self)->mc->servers); i++) {
+ memcached_server_st *server = DATA(self)->mc->servers + i;
memcached_stat_st stats;
if(memcached_stat_servername(&stats, "", server->hostname, server->port) != 0)

0 comments on commit 098921f

Please sign in to comment.