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
5fa8d305
Commit
5fa8d305
authored
Nov 01, 2010
by
Pieter Noordhuis
Browse files
There is no longer need for a separate redisDisconnect
parent
30a9f8f2
Changes
3
Show whitespace changes
Inline
Side-by-side
README.md
View file @
5fa8d305
...
...
@@ -107,6 +107,15 @@ Note that this function will take care of freeing sub-replies objects
contained in arrays and nested arrays, so there is no need for the user to
free the sub replies (it is actually harmful and will corrupt the memory).
### Cleaning up
To disconnect and free the context the following function can be used:
void redisFree(redisContext *c);
This function immediately closes the socket and then free's the allocations done in
creating the context.
### Sending commands (cont'd)
Together with
`redisCommand`
, the function
`redisCommandArgv`
can be used to issue commands.
...
...
hiredis.c
View file @
5fa8d305
...
...
@@ -642,15 +642,10 @@ static redisContext *redisContextInit() {
return
c
;
}
void
redisDisconnect
(
redisContext
*
c
)
{
close
(
c
->
fd
);
c
->
flags
&=
~
REDIS_CONNECTED
;
}
void
redisFree
(
redisContext
*
c
)
{
/* Disconnect before free'ing if not yet disconnected. */
if
(
c
->
flags
&
REDIS_CONNECTED
)
redisDisconnect
(
c
);
close
(
c
->
fd
);
if
(
c
->
error
!=
NULL
)
sdsfree
(
c
->
error
);
if
(
c
->
obuf
!=
NULL
)
...
...
hiredis.h
View file @
5fa8d305
...
...
@@ -112,7 +112,6 @@ int redisFormatCommandArgv(char **target, int argc, const char **argv, const siz
redisContext
*
redisConnect
(
const
char
*
ip
,
int
port
);
redisContext
*
redisConnectNonBlock
(
const
char
*
ip
,
int
port
);
int
redisSetReplyObjectFunctions
(
redisContext
*
c
,
redisReplyObjectFunctions
*
fn
);
void
redisDisconnect
(
redisContext
*
c
);
void
redisFree
(
redisContext
*
c
);
int
redisBufferRead
(
redisContext
*
c
);
int
redisBufferWrite
(
redisContext
*
c
,
int
*
done
);
...
...
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