diff options
author | Volker Lendecke <vl@samba.org> | 2009-02-07 23:36:23 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-02-08 13:53:49 +0100 |
commit | 32a75292430910f73d4fa44b0628e9013aa5f161 (patch) | |
tree | 3b3ccbc1a7b42a5ead34dda3c67a32038de51080 /source3/rpc_parse | |
parent | b1677505a5b94493fbec7ca220daae72e4c34fb9 (diff) | |
download | samba-32a75292430910f73d4fa44b0628e9013aa5f161.tar.gz samba-32a75292430910f73d4fa44b0628e9013aa5f161.tar.bz2 samba-32a75292430910f73d4fa44b0628e9013aa5f161.zip |
Most RPC requests do not need a full fragment, start smaller
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r-- | source3/rpc_parse/parse_prs.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index e8103ad866..bc9202cccc 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -267,12 +267,12 @@ bool prs_grow(prs_struct *ps, uint32 extra_space) extra_space -= (ps->buffer_size - ps->data_offset); if(ps->buffer_size == 0) { + /* - * Ensure we have at least a PDU's length, or extra_space, whichever - * is greater. + * Start with 128 bytes (arbitrary value), enough for small rpc + * requests */ - - new_size = MAX(RPC_MAX_PDU_FRAG_LEN,extra_space); + new_size = MAX(128, extra_space); if((ps->data_p = (char *)SMB_MALLOC(new_size)) == NULL) { DEBUG(0,("prs_grow: Malloc failure for size %u.\n", (unsigned int)new_size)); @@ -281,10 +281,13 @@ bool prs_grow(prs_struct *ps, uint32 extra_space) memset(ps->data_p, '\0', (size_t)new_size ); } else { /* - * If the current buffer size is bigger than the space needed, just - * double it, else add extra_space. + * If the current buffer size is bigger than the space needed, + * just double it, else add extra_space. Always keep 64 bytes + * more, so that after we added a large blob we don't have to + * realloc immediately again. */ - new_size = MAX(ps->buffer_size*2, ps->buffer_size + extra_space); + new_size = MAX(ps->buffer_size*2, + ps->buffer_size + extra_space + 64); if ((ps->data_p = (char *)SMB_REALLOC(ps->data_p, new_size)) == NULL) { DEBUG(0,("prs_grow: Realloc failure for size %u.\n", |