author | Florian Forster <octo@huhu.verplant.org> | |
Wed, 15 Jul 2009 09:10:19 +0000 (11:10 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Wed, 15 Jul 2009 09:10:19 +0000 (11:10 +0200) |
Conflicts:
src/memcached.c
src/memcached.c
1 | 2 | |||
---|---|---|---|---|
src/configfile.c | patch | | diff1 | | diff2 | | blob | history |
src/memcached.c | patch | | diff1 | | diff2 | | blob | history |
version-gen.sh | patch | | diff1 | | diff2 | | blob | history |
diff --cc src/configfile.c
Simple merge
diff --cc src/memcached.c
index 06cf2001b6287adb49b8843fc69994f962ae1c65,2d999ce4e15be392dc9a3faed8dfca34395fee4c..b3321578894d7e3ffc49a4a7126143ff0e3d2b87
--- 1/src/memcached.c
--- 2/src/memcached.c
+++ b/src/memcached.c
int fd;
ssize_t status;
int buffer_fill;
+ int i = 0;
- const char *host;
- const char *port;
+ if (memcached_socket != NULL) {
+ struct sockaddr_un serv_addr;
- struct addrinfo ai_hints;
- struct addrinfo *ai_list, *ai_ptr;
- int ai_return, i = 0;
+ memset (&serv_addr, 0, sizeof (serv_addr));
+ serv_addr.sun_family = AF_UNIX;
+ sstrncpy (serv_addr.sun_path, memcached_socket,
+ sizeof (serv_addr.sun_path));
- memset (&ai_hints, '\0', sizeof (ai_hints));
- ai_hints.ai_flags = 0;
-#ifdef AI_ADDRCONFIG
-/* ai_hints.ai_flags |= AI_ADDRCONFIG; */
-#endif
- ai_hints.ai_family = AF_INET;
- ai_hints.ai_socktype = SOCK_STREAM;
- ai_hints.ai_protocol = 0;
+ /* create our socket descriptor */
+ fd = socket (AF_UNIX, SOCK_STREAM, 0);
+ if (fd < 0) {
+ char errbuf[1024];
+ ERROR ("memcached: unix socket: %s", sstrerror (errno, errbuf,
+ sizeof (errbuf)));
+ return -1;
+ }
- host = memcached_host;
- if (host == NULL) {
- host = MEMCACHED_DEF_HOST;
+ /* connect to the memcached daemon */
+ status = (ssize_t) connect (fd, (struct sockaddr *) &serv_addr,
+ sizeof (serv_addr));
+ if (status != 0) {
+ shutdown (fd, SHUT_RDWR);
+ close (fd);
+ fd = -1;
+ }
}
+ else { /* if (memcached_socket == NULL) */
+ const char *host;
+ const char *port;
- port = memcached_port;
- if (strlen (port) == 0) {
- port = MEMCACHED_DEF_PORT;
- }
+ struct addrinfo ai_hints;
+ struct addrinfo *ai_list, *ai_ptr;
+ int ai_return = 0;
- if ((ai_return = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0) {
- char errbuf[1024];
- ERROR ("memcached: getaddrinfo (%s, %s): %s",
- host, port,
- (ai_return == EAI_SYSTEM)
- ? sstrerror (errno, errbuf, sizeof (errbuf))
- : gai_strerror (ai_return));
- return -1;
- }
+ memset (&ai_hints, '\0', sizeof (ai_hints));
+ ai_hints.ai_flags = 0;
+#ifdef AI_ADDRCONFIG
+ /* ai_hints.ai_flags |= AI_ADDRCONFIG; */
+#endif
+ ai_hints.ai_family = AF_INET;
+ ai_hints.ai_socktype = SOCK_STREAM;
+ ai_hints.ai_protocol = 0;
- fd = -1;
- for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next) {
- /* create our socket descriptor */
- if ((fd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol)) < 0) {
+ host = memcached_host;
+ if (host == NULL) {
+ host = MEMCACHED_DEF_HOST;
+ }
+
+ port = memcached_port;
+ if (strlen (port) == 0) {
+ port = MEMCACHED_DEF_PORT;
+ }
+
- if ((ai_return = getaddrinfo (host, port, NULL, &ai_list)) != 0) {
++ if ((ai_return = getaddrinfo (host, port, &ai_hints, &ai_list)) != 0) {
char errbuf[1024];
- ERROR ("memcached: socket: %s", sstrerror (errno, errbuf, sizeof (errbuf)));
- continue;
+ ERROR ("memcached: getaddrinfo (%s, %s): %s",
+ host, port,
+ (ai_return == EAI_SYSTEM)
+ ? sstrerror (errno, errbuf, sizeof (errbuf))
+ : gai_strerror (ai_return));
+ return -1;
}
- /* connect to the memcached daemon */
- if (connect (fd, (struct sockaddr *) ai_ptr->ai_addr, ai_ptr->ai_addrlen)) {
- shutdown(fd, SHUT_RDWR);
- close(fd);
- fd = -1;
- continue;
+ fd = -1;
+ for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next) {
+ /* create our socket descriptor */
+ fd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol);
+ if (fd < 0) {
+ char errbuf[1024];
+ ERROR ("memcached: socket: %s", sstrerror (errno, errbuf, sizeof (errbuf)));
+ continue;
+ }
+
+ /* connect to the memcached daemon */
+ status = (ssize_t) connect (fd, (struct sockaddr *) ai_ptr->ai_addr, ai_ptr->ai_addrlen);
+ if (status != 0) {
+ shutdown (fd, SHUT_RDWR);
+ close (fd);
+ fd = -1;
+ continue;
+ }
+
+ /* A socket could be opened and connecting succeeded. We're
+ * done. */
+ break;
}
- /* A socket could be opened and connecting succeeded. We're
- * done. */
- break;
+ freeaddrinfo (ai_list);
}
- freeaddrinfo (ai_list);
-
if (fd < 0) {
ERROR ("memcached: Could not connect to daemon.");
return -1;
diff --cc version-gen.sh
index 6fcfb1e41e5bdb3aa46d138774c30dbdda31e70d,4d1f2ed32af91af53c94cbfba448c704ae04b1d5..cfced9ecf8524b354925cf42c30d37842ad52450
--- 1/version-gen.sh
--- 2/version-gen.sh
+++ b/version-gen.sh
#!/bin/sh
-DEFAULT_VERSION="4.6.3.git"
+DEFAULT_VERSION="4.7.1.git"
- VERSION="$( git describe 2> /dev/null | sed -e 's/^collectd-//' )"
+ VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`"
if test -z "$VERSION"; then
VERSION="$DEFAULT_VERSION"