* With that in mind, let me give you some pointers into the source:
* storage.c/h - Implements the item store for this server and not really
* interesting for this example.
- * interface_v0.c - Shows an implementation of the memcached server by using
+ * interface_v0.cc - Shows an implementation of the memcached server by using
* the "raw" access to the packets as they arrive
- * interface_v1.c - Shows an implementation of the memcached server by using
+ * interface_v1.cc - Shows an implementation of the memcached server by using
* the more "logical" interface.
- * memcached_light.c - This file sets up all of the sockets and run the main
+ * memcached_light.cc- This file sets up all of the sockets and run the main
* message loop.
*
*
* the library)
*/
-#include "config.h"
+#include <mem_config.h>
-#include <libmemcachedprotocol-0.0/handler.h>
+#include <libmemcachedprotocol-0/handler.h>
#include <libmemcached/socket.hpp>
#include <example/byteorder.h>
#include "example/storage.h"
#include <getopt.h>
#include <iostream>
#include <sys/types.h>
-#include <unistd.h>
-
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
extern memcached_binary_protocol_callback_st interface_v0_impl;
extern memcached_binary_protocol_callback_st interface_v1_impl;
options_st() :
service("9999"),
- is_verbose(false)
+ is_verbose(false),
+ opt_daemon(false)
{
}
};
flags|= EV_READ;
}
- event_set(&client->event, (intptr_t)fd, flags, drive_client, client);
+ event_set(&client->event, int(fd), flags, drive_client, client);
event_base_set(event_base, &client->event);
if (event_add(&client->event, 0) == -1)
struct connection *client = &socket_userdata_map[sock];
client->userdata= c;
- event_set(&client->event, (intptr_t)sock, EV_READ, drive_client, client);
+ event_set(&client->event, int(sock), EV_READ, drive_client, client);
event_base_set(event_base, &client->event);
if (event_add(&client->event, 0) == -1)
{
struct connection *conn= &socket_userdata_map[server_sockets[xx]];
conn->userdata= protocol_handle;
- event_set(&conn->event, (intptr_t)server_sockets[xx], EV_READ | EV_PERSIST, accept_handler, conn);
+ event_set(&conn->event, int(server_sockets[xx]), EV_READ | EV_PERSIST, accept_handler, conn);
event_base_set(event_base, &conn->event);
if (event_add(&conn->event, 0) == -1)