mirror of
https://github.com/fluencelabs/redis
synced 2025-06-12 08:41:21 +00:00
Lua call of Redis command work in progress: sorry I have to go to the cinema to watch the Source Code movie
This commit is contained in:
@ -14,14 +14,20 @@ redisClient *createClient(int fd) {
|
||||
redisClient *c = zmalloc(sizeof(redisClient));
|
||||
c->bufpos = 0;
|
||||
|
||||
anetNonBlock(NULL,fd);
|
||||
anetTcpNoDelay(NULL,fd);
|
||||
if (aeCreateFileEvent(server.el,fd,AE_READABLE,
|
||||
readQueryFromClient, c) == AE_ERR)
|
||||
{
|
||||
close(fd);
|
||||
zfree(c);
|
||||
return NULL;
|
||||
/* passing -1 as fd it is possible to create a non connected client.
|
||||
* This is useful since all the Redis commands needs to be executed
|
||||
* in the context of a client. When commands are executed in other
|
||||
* contexts (for instance a Lua script) we need a non connected client. */
|
||||
if (fd != -1) {
|
||||
anetNonBlock(NULL,fd);
|
||||
anetTcpNoDelay(NULL,fd);
|
||||
if (aeCreateFileEvent(server.el,fd,AE_READABLE,
|
||||
readQueryFromClient, c) == AE_ERR)
|
||||
{
|
||||
close(fd);
|
||||
zfree(c);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
selectDb(c,0);
|
||||
|
Reference in New Issue
Block a user