Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
a6e46274
Commit
a6e46274
authored
Nov 21, 2011
by
antirez
Browse files
Close client connection and log the event when the client input buffer reaches 1GB.
parent
93babe4b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
a6e46274
...
@@ -862,6 +862,13 @@ void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mask) {
...
@@ -862,6 +862,13 @@ void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mask) {
}
else
{
}
else
{
return
;
return
;
}
}
if
(
sdslen
(
c
->
querybuf
)
>
server
.
client_max_querybuf_len
)
{
sds
ci
=
getClientInfoString
(
c
);
redisLog
(
REDIS_WARNING
,
"Closing client that reached max query buffer length: %s"
,
ci
);
sdsfree
(
ci
);
freeClient
(
c
);
return
;
}
processInputBuffer
(
c
);
processInputBuffer
(
c
);
}
}
...
...
src/redis.c
View file @
a6e46274
...
@@ -804,6 +804,7 @@ void initServerConfig() {
...
@@ -804,6 +804,7 @@ void initServerConfig() {
server
.
dbnum
=
REDIS_DEFAULT_DBNUM
;
server
.
dbnum
=
REDIS_DEFAULT_DBNUM
;
server
.
verbosity
=
REDIS_VERBOSE
;
server
.
verbosity
=
REDIS_VERBOSE
;
server
.
maxidletime
=
REDIS_MAXIDLETIME
;
server
.
maxidletime
=
REDIS_MAXIDLETIME
;
server
.
client_max_querybuf_len
=
REDIS_MAX_QUERYBUF_LEN
;
server
.
saveparams
=
NULL
;
server
.
saveparams
=
NULL
;
server
.
loading
=
0
;
server
.
loading
=
0
;
server
.
logfile
=
NULL
;
/* NULL = log on standard output */
server
.
logfile
=
NULL
;
/* NULL = log on standard output */
...
...
src/redis.h
View file @
a6e46274
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
/* Static server configuration */
/* Static server configuration */
#define REDIS_SERVERPORT 6379
/* TCP port */
#define REDIS_SERVERPORT 6379
/* TCP port */
#define REDIS_MAXIDLETIME 0
/* default client timeout: infinite */
#define REDIS_MAXIDLETIME 0
/* default client timeout: infinite */
#define REDIS_MAX_QUERYBUF_LEN (1024*1024*1024)
/* 1GB max query buffer. */
#define REDIS_IOBUF_LEN (1024*16)
#define REDIS_IOBUF_LEN (1024*16)
#define REDIS_LOADBUF_LEN 1024
#define REDIS_LOADBUF_LEN 1024
#define REDIS_DEFAULT_DBNUM 16
#define REDIS_DEFAULT_DBNUM 16
...
@@ -418,6 +419,7 @@ struct redisServer {
...
@@ -418,6 +419,7 @@ struct redisServer {
/* Configuration */
/* Configuration */
int
verbosity
;
int
verbosity
;
int
maxidletime
;
int
maxidletime
;
size_t
client_max_querybuf_len
;
int
dbnum
;
int
dbnum
;
int
daemonize
;
int
daemonize
;
int
appendonly
;
int
appendonly
;
...
@@ -700,6 +702,7 @@ void addReplyMultiBulkLen(redisClient *c, long length);
...
@@ -700,6 +702,7 @@ void addReplyMultiBulkLen(redisClient *c, long length);
void
*
dupClientReplyValue
(
void
*
o
);
void
*
dupClientReplyValue
(
void
*
o
);
void
getClientsMaxBuffers
(
unsigned
long
*
longest_output_list
,
void
getClientsMaxBuffers
(
unsigned
long
*
longest_output_list
,
unsigned
long
*
biggest_input_buffer
);
unsigned
long
*
biggest_input_buffer
);
sds
getClientInfoString
(
redisClient
*
client
);
void
rewriteClientCommandVector
(
redisClient
*
c
,
int
argc
,
...);
void
rewriteClientCommandVector
(
redisClient
*
c
,
int
argc
,
...);
#ifdef __GNUC__
#ifdef __GNUC__
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment