[tracker/dbus-fd-experiment: 9/13] Steroids: Put send buffer size in shared header
- From: Adrien Bustany <abustany src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/dbus-fd-experiment: 9/13] Steroids: Put send buffer size in shared header
- Date: Mon, 24 May 2010 14:29:32 +0000 (UTC)
commit aa16355c321700563d84cf203df98eec3055dc08
Author: Adrien Bustany <abustany gnome org>
Date: Mon May 24 08:52:52 2010 -0400
Steroids: Put send buffer size in shared header
src/tracker-store/tracker-steroids.c | 12 +++++-------
src/tracker-store/tracker-steroids.h | 2 ++
2 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/tracker-store/tracker-steroids.c b/src/tracker-store/tracker-steroids.c
index 06c323b..ae9a8f3 100644
--- a/src/tracker-store/tracker-steroids.c
+++ b/src/tracker-store/tracker-steroids.c
@@ -28,8 +28,6 @@ G_DEFINE_TYPE (TrackerSteroids, tracker_steroids, G_TYPE_OBJECT)
#define TRACKER_STEROIDS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_STEROIDS, TrackerSteroidsPrivate))
-#define SEND_BUFFER_SIZE 65536
-
typedef struct {
GHashTable *clients;
} TrackerSteroidsPrivate;
@@ -39,7 +37,7 @@ typedef struct {
char *query;
int fd;
unsigned int send_buffer_index;
- char send_buffer[SEND_BUFFER_SIZE];
+ char send_buffer[STEROIDS_BUFFER_SIZE];
guint request_id;
DBusGMethodInvocation *context;
} ClientInfo;
@@ -134,13 +132,13 @@ page_flush (ClientInfo *info)
/* Put an "end of page" marker if there was still some space left
* The "end of page" marker is one byte long, so we're sure there's at
* least space for the marker */
- if (SEND_BUFFER_SIZE != info->send_buffer_index) {
+ if (STEROIDS_BUFFER_SIZE != info->send_buffer_index) {
memset (info->send_buffer + info->send_buffer_index,
STEROIDS_EOP,
sizeof (char));
}
- buffer_send (info-> fd, info->send_buffer, SEND_BUFFER_SIZE);
+ buffer_send (info-> fd, info->send_buffer, STEROIDS_BUFFER_SIZE);
info->send_buffer_index = 0;
}
@@ -233,7 +231,7 @@ query_inthread (TrackerDBCursor *cursor,
+ last_offset /* columns data */
+ n_columns * sizeof (char); /* trailing \0 for each column */
- if (row_size > SEND_BUFFER_SIZE) {
+ if (row_size > STEROIDS_BUFFER_SIZE) {
char *buffer = g_malloc (sizeof (char) * row_size + sizeof (int));
char *dst = buffer;
@@ -268,7 +266,7 @@ query_inthread (TrackerDBCursor *cursor,
continue;
}
- if (row_size > SEND_BUFFER_SIZE - info->send_buffer_index) {
+ if (row_size > STEROIDS_BUFFER_SIZE - info->send_buffer_index) {
page_flush (info);
}
diff --git a/src/tracker-store/tracker-steroids.h b/src/tracker-store/tracker-steroids.h
index 750dafe..f95083a 100644
--- a/src/tracker-store/tracker-steroids.h
+++ b/src/tracker-store/tracker-steroids.h
@@ -35,6 +35,8 @@ G_BEGIN_DECLS
#define TRACKER_IS_STEROIDS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_TYPE_STEROIDS))
#define TRACKER_STEROIDS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_TYPE_STEROIDS, TrackerSteroidsClass))
+#define STEROIDS_BUFFER_SIZE 65536
+
#define STEROIDS_RC_ERROR 0
#define STEROIDS_RC_ROW 1
#define STEROIDS_RC_DONE 2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]