X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/7c775e09433249e9d64c24ff92d2e5b716f5eb2d..eb46f4bd7bf086089b0a48f1e2bed2aadb46d185:/redis.c diff --git a/redis.c b/redis.c index a961c247..b7fd3b5b 100644 --- a/redis.c +++ b/redis.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2009, Salvatore Sanfilippo + * Copyright (c) 2009-2010, Salvatore Sanfilippo * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -2334,7 +2334,8 @@ static void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mas } else { return; } - processInputBuffer(c); + if (!(c->flags & REDIS_BLOCKED)) + processInputBuffer(c); } static int selectDb(redisClient *c, int id) { @@ -2346,7 +2347,7 @@ static int selectDb(redisClient *c, int id) { static void *dupClientReplyValue(void *o) { incrRefCount((robj*)o); - return 0; + return o; } static redisClient *createClient(int fd) { @@ -6138,7 +6139,6 @@ static void blockForKeys(redisClient *c, robj **keys, int numkeys, time_t timeou } /* Mark the client as a blocked client */ c->flags |= REDIS_BLOCKED; - aeDeleteFileEvent(server.el,c->fd,AE_READABLE); server.blpop_blocked_clients++; } @@ -6166,14 +6166,7 @@ static void unblockClientWaitingData(redisClient *c) { c->blockingkeys = NULL; c->flags &= (~REDIS_BLOCKED); server.blpop_blocked_clients--; - /* Ok now we are ready to get read events from socket, note that we - * can't trap errors here as it's possible that unblockClientWaitingDatas() is - * called from freeClient() itself, and the only thing we can do - * if we failed to register the READABLE event is to kill the client. - * Still the following function should never fail in the real world as - * we are sure the file descriptor is sane, and we exit on out of mem. */ - aeCreateFileEvent(server.el, c->fd, AE_READABLE, readQueryFromClient, c); - /* As a final step we want to process data if there is some command waiting + /* We want to process data if there is some command waiting * in the input buffer. Note that this is safe even if * unblockClientWaitingData() gets called from freeClient() because * freeClient() will be smart enough to call this function @@ -7406,7 +7399,7 @@ static int vmWriteObjectOnSwap(robj *o, off_t page) { if (fseeko(server.vm_fp,page*server.vm_page_size,SEEK_SET) == -1) { if (server.vm_enabled) pthread_mutex_unlock(&server.io_swapfile_mutex); redisLog(REDIS_WARNING, - "Critical VM problem in vmSwapObjectBlocking(): can't seek: %s", + "Critical VM problem in vmWriteObjectOnSwap(): can't seek: %s", strerror(errno)); return REDIS_ERR; } @@ -7922,8 +7915,8 @@ static void *IOThreadEntryPoint(void *arg) { lockThreadedIO(); if (listLength(server.io_newjobs) == 0) { /* No new jobs in queue, exit. */ - redisLog(REDIS_DEBUG,"Thread %lld exiting, nothing to do", - (long long) pthread_self()); + redisLog(REDIS_DEBUG,"Thread %ld exiting, nothing to do", + (long) pthread_self()); server.io_active_threads--; unlockThreadedIO(); return NULL; @@ -7936,8 +7929,8 @@ static void *IOThreadEntryPoint(void *arg) { listAddNodeTail(server.io_processing,j); ln = listLast(server.io_processing); /* We use ln later to remove it */ unlockThreadedIO(); - redisLog(REDIS_DEBUG,"Thread %lld got a new job (type %d): %p about key '%s'", - (long long) pthread_self(), j->type, (void*)j, (char*)j->key->ptr); + redisLog(REDIS_DEBUG,"Thread %ld got a new job (type %d): %p about key '%s'", + (long) pthread_self(), j->type, (void*)j, (char*)j->key->ptr); /* Process the Job */ if (j->type == REDIS_IOJOB_LOAD) { @@ -7952,8 +7945,8 @@ static void *IOThreadEntryPoint(void *arg) { } /* Done: insert the job into the processed queue */ - redisLog(REDIS_DEBUG,"Thread %lld completed the job: %p (key %s)", - (long long) pthread_self(), (void*)j, (char*)j->key->ptr); + redisLog(REDIS_DEBUG,"Thread %ld completed the job: %p (key %s)", + (long) pthread_self(), (void*)j, (char*)j->key->ptr); lockThreadedIO(); listDelNode(server.io_processing,ln); listAddNodeTail(server.io_processed,j);