Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed a bug in stats returned by the 'INFO' command. Misc code cleanu…

…p and organization changes.
  • Loading branch information...
commit 8048b1a6d9b0b2bfe5ec92fbf4e0e36e357dee18 1 parent d709402
Nick Gerakines authored
7 src/barbershop.c
View
@@ -35,6 +35,7 @@ THE SOFTWARE.
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
+#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
@@ -175,9 +176,9 @@ void on_read(int fd, short ev, void *arg) {
time(&current_time);
sprintf(out, "uptime:%d\r\n", (int)(current_time - app_stats.started_at)); reply(fd, out);
sprintf(out, "version:%s\r\n", app_stats.version); reply(fd, out);
- sprintf(out, "updates:%d\r\n", app_stats.updates); reply(fd, out);
- sprintf(out, "items:%d\r\n", app_stats.items); reply(fd, out);
- sprintf(out, "pools:%d\r\n", app_stats.pools); reply(fd, out);
+ sprintf(out, "updates:%u\r\n", app_stats.updates); reply(fd, out);
+ sprintf(out, "items:%u\r\n", app_stats.items); reply(fd, out);
+ sprintf(out, "pools:%u\r\n", app_stats.pools); reply(fd, out);
} else {
reply(fd, "-ERROR\r\n");
}
2  src/benchmark.c
View
@@ -131,7 +131,7 @@ int main(int argc, char **argv) {
send_command(sd, msg);
n++;
}
- send_command(sd, "stats\r\n");
+ send_command(sd, "INFO\r\n");
close(sd);
2  src/client.c
View
@@ -208,7 +208,6 @@ void send_command(int sd, char *command) {
if (buf_len >= 2) {
resp = malloc(1 + buf_len);
memcpy(resp, buf+1, buf_len);
- resp[buf_len] = 0;
printf("%s\n", resp);
free(resp);
} else {
@@ -217,7 +216,6 @@ void send_command(int sd, char *command) {
break;
default:
printf("%s\n", buf);
- // printf("protocol error, got '%c' as reply type byte\n", buf[0]);
break;
}
}
4 src/stats.h
View
@@ -32,12 +32,8 @@ struct _app_stats {
unsigned int updates;
// Number of items created/inserted into `items`
unsigned int items;
- // Number of items created/inserted into `items` that reflects successful `next` calls
- unsigned int items_gc;
// Number of created pools
unsigned int pools;
- // Number of pools that reflects successful `next` calls that empty pools
- unsigned int pools_gc;
} app_stats;
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.