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
hiredis
Commits
e51ddd7c
Commit
e51ddd7c
authored
Nov 02, 2010
by
Pieter Noordhuis
Browse files
Make setError receive an sds
parent
b8b29665
Changes
2
Hide whitespace changes
Inline
Side-by-side
hiredis.c
View file @
e51ddd7c
...
...
@@ -614,10 +614,10 @@ int redisFormatCommandArgv(char **target, int argc, const char **argv, const siz
return
totlen
;
}
void
__redisSetError
(
redisContext
*
c
,
int
type
,
const
char
*
str
)
{
void
__redisSetError
(
redisContext
*
c
,
int
type
,
const
sds
err
str
)
{
c
->
err
=
type
;
if
(
str
)
{
c
->
errstr
=
sdsnew
(
str
)
;
if
(
errstr
!=
NULL
)
{
c
->
errstr
=
err
str
;
}
else
{
/* Only REDIS_ERR_IO may lack a description! */
assert
(
type
==
REDIS_ERR_IO
);
...
...
@@ -700,7 +700,7 @@ int redisBufferRead(redisContext *c) {
}
}
else
if
(
nread
==
0
)
{
__redisSetError
(
c
,
REDIS_ERR_EOF
,
"Server closed the connection"
);
sdsnew
(
"Server closed the connection"
)
)
;
return
REDIS_ERR
;
}
else
{
__redisCreateReplyReader
(
c
);
...
...
@@ -747,7 +747,8 @@ int redisBufferWrite(redisContext *c, int *done) {
static
int
__redisGetReply
(
redisContext
*
c
,
void
**
reply
)
{
__redisCreateReplyReader
(
c
);
if
(
redisReplyReaderGetReply
(
c
->
reader
,
reply
)
==
REDIS_ERR
)
{
__redisSetError
(
c
,
REDIS_ERR_PROTOCOL
,((
redisReader
*
)
c
->
reader
)
->
error
);
__redisSetError
(
c
,
REDIS_ERR_PROTOCOL
,
sdsnew
(((
redisReader
*
)
c
->
reader
)
->
error
));
return
REDIS_ERR
;
}
return
REDIS_OK
;
...
...
net.c
View file @
e51ddd7c
...
...
@@ -46,7 +46,7 @@
#include "sds.h"
/* Forward declaration */
void
__redisSetError
(
redisContext
*
c
,
int
type
,
const
char
*
err
);
void
__redisSetError
(
redisContext
*
c
,
int
type
,
sds
err
);
static
int
redisSetNonBlock
(
redisContext
*
c
,
int
fd
)
{
int
flags
;
...
...
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