summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2017-01-06 17:03:32 +0100
committerOndrej Holy <oholy@redhat.com>2017-01-16 15:53:10 +0100
commitb0e627b502a49e45d2412f3b50b12963a4a253f0 (patch)
tree081c5eda645f3af36c2685f3d51a5f65d8e4cc9a
parent1482097a0dd8aecd93958aab5fc601568b4cfa3b (diff)
downloadgvfs-b0e627b502a49e45d2412f3b50b12963a4a253f0.tar.gz
sftp: Merge 3 constants into one
MAX_BUFFER_SIZE, PULL_BLOCKSIZE, and PUSH_BLOCKSIZE defines the same value. Let's merge them into MAX_BUFFER_SIZE. https://bugzilla.gnome.org/show_bug.cgi?id=776824
-rw-r--r--daemon/gvfsbackendsftp.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c
index 6a653024..7e6bf155 100644
--- a/daemon/gvfsbackendsftp.c
+++ b/daemon/gvfsbackendsftp.c
@@ -5254,7 +5254,6 @@ check_finished_or_cancelled_job (GVfsJob *job)
/* The push sliding window mechanism is based on the one in the OpenSSH sftp
* client. */
-#define PUSH_BLOCKSIZE 32768
#define PUSH_MAX_REQUESTS 64
typedef struct {
@@ -5280,7 +5279,7 @@ typedef struct {
char *tempname;
int temp_count;
- char buffer[PUSH_BLOCKSIZE];
+ char buffer[MAX_BUFFER_SIZE];
} SftpPushHandle;
typedef struct {
@@ -5344,7 +5343,7 @@ push_enqueue_request (SftpPushHandle *handle)
{
g_input_stream_read_async (handle->in,
handle->buffer,
- PUSH_BLOCKSIZE,
+ MAX_BUFFER_SIZE,
G_PRIORITY_DEFAULT,
NULL,
push_read_cb, handle);
@@ -5973,7 +5972,6 @@ try_push (GVfsBackend *backend,
* client. It is complicated because requests can be returned out of order. */
#define PULL_MAX_REQUESTS 64 /* Never have more than this many requests outstanding */
-#define PULL_BLOCKSIZE 32768 /* Request this much data per request */
#define PULL_SIZE_INCOMPLETE -1 /* Indicates an incomplete fstat() request */
#define PULL_SIZE_INVALID -2 /* Indicates that no fstat() request is in progress */
@@ -6325,8 +6323,8 @@ pull_enqueue_request (SftpPullHandle *handle, guint64 offset, guint32 len)
static void
pull_enqueue_next_request (SftpPullHandle *handle)
{
- pull_enqueue_request (handle, handle->offset, PULL_BLOCKSIZE);
- handle->offset += PULL_BLOCKSIZE;
+ pull_enqueue_request (handle, handle->offset, MAX_BUFFER_SIZE);
+ handle->offset += MAX_BUFFER_SIZE;
}
static void