summaryrefslogtreecommitdiff
path: root/src/networking.c
Commit message (Collapse)AuthorAgeFilesLines
...
* PSYNC: work in progress, preview #2, rebased to unstable.antirez2013-02-121-18/+50
|
* Set SO_KEEPALIVE on client sockets if configured to do so.antirez2013-02-081-0/+2
|
* TCP_NODELAY after SYNC: changes to the implementation.antirez2013-02-051-1/+1
|
* Fix decrRefCount() prototype from void to robj pointer.antirez2013-01-281-3/+3
| | | | | | | | | decrRefCount used to get its argument as a void* pointer in order to be used as destructor where a 'void free_object(void*)' prototype is expected. However this made simpler to introduce bugs by freeing the wrong pointer. This commit fixes the argument type and introduces a new wrapper called decrRefCountVoid() that can be used when the void* argument is needed.
* Additionally two typos fixed thanks to @jodalantirez2013-01-191-1/+1
|
* Fixed many typos.guiquanz2013-01-191-4/+4
|
* Fix an error reply for CLIENT commandbitterb2013-01-191-1/+1
|
* Typo fixed, ASCI -> ASCII.antirez2013-01-151-1/+1
|
* CLIENT GETNAME and CLIENT SETNAME introduced.antirez2013-01-151-2/+39
| | | | | | | | | | | | | | | | | | | | Sometimes it is much simpler to debug complex Redis installations if it is possible to assign clients a name that is displayed in the CLIENT LIST output. This is the case, for example, for "leaked" connections. The ability to provide a name to the client makes it quite trivial to understand what is the part of the code implementing the client not releasing the resources appropriately. Behavior: CLIENT SETNAME: set a name for the client, or remove the current name if an empty name is set. CLIENT GETNAME: get the current name, or a nil. CLIENT LIST: now displays the client name if any. Thanks to Mark Gravell for pushing this idea forward.
* Better error reporting when fd event creation fails.antirez2013-01-031-1/+3
|
* Memory leak fixed: release client's bpop->keys dictionary.antirez2012-12-031-0/+1
| | | | | | | | | | | | | | | | | Refactoring performed after issue #801 resolution (see commit 2f87cf8b0162bd9d78c3a89860c0971cd71d39db) introduced a memory leak that is fixed by this commit. I simply forgot to free the new allocated dictionary in the client structure trusting the output of "make test" on OSX. However due to changes in the "leaks" utility the test was no longer testing memory leaks. This problem was also fixed. Fortunately the CI test running at ci.redis.io spotted the bug in the valgrind run. The leak never ended into a stable release.
* Blocking POP: use a dictionary to store keys clinet side.antirez2012-12-021-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | To store the keys we block for during a blocking pop operation, in the case the client is blocked for more data to arrive, we used a simple linear array of redis objects, in the blockingState structure: robj **keys; int count; However in order to fix issue #801 we also use a dictionary in order to avoid to end in the blocked clients queue for the same key multiple times with the same client. The dictionary was only temporary, just to avoid duplicates, but since we create / destroy it there is no point in doing this duplicated work, so this commit simply use a dictionary as the main structure to store the keys we are blocked for. So instead of the previous fields we now just have: dict *keys; This simplifies the code and reduces the work done by the server during a blocking POP operation.
* BSD license added to every C source and header file.antirez2012-11-081-0/+29
|
* fix typo in comments (redis.c, networking.c)Yecheng Fu2012-11-011-6/+6
|
* Unix socket clients properly displayed in MONITOR and CLIENT LIST.antirez2012-11-011-6/+10
| | | | This also fixes issue #745.
* REPLCONF internal command introduced.antirez2012-06-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The REPLCONF command is an internal command (not designed to be directly used by normal clients) that allows a slave to set some replication related state in the master before issuing SYNC to start the replication. The initial motivation for this command, and the only reason currently it is used by the implementation, is to let the slave instance communicate its listening port to the slave, so that the master can show all the slaves with their listening ports in the "replication" section of the INFO output. This allows clients to auto discover and query all the slaves attached into a master. Currently only a single option of the REPLCONF command is supported, and it is called "listening-port", so the slave now starts the replication process with something like the following chat: REPLCONF listening-prot 6380 SYNC Note that this works even if the master is an older version of Redis and does not understand REPLCONF, because the slave ignores the REPLCONF error. In the future REPLCONF can be used for partial replication and other replication related features where there is the need to exchange information between master and slave. NOTE: This commit also fixes a bug: the INFO outout already carried information about slaves, but the port was broken, and was obtained with getpeername(2), so it was actually just the ephemeral port used by the slave to connect to the master as a client.
* Fix c->reply_bytes computation in setDeferredMultiBulkLength()antirez2012-06-151-0/+4
| | | | | | | | | | | | | | | | | | | In order to implement reply buffer limits introduced in 2.6 and useful to close the connection under user-selected circumastances of big output buffers (for instance slow consumers in pub/sub, a blocked slave, and so forth) Redis takes a counter with the amount of used memory in objects inside the output list stored into c->reply. The computation was broken in the function setDeferredMultiBulkLength(), in the case the object was glued with the next one. This caused the c->reply_bytes field to go out of sync, be subtracted more than needed, and wrap back near to ULONG_MAX values. This commit fixes this bug and adds an assertion that is able to trap this class of problems. This problem was discovered looking at the INFO output of an unrelated issue (issue #547).
* New client info field added to CLIENT LIST output: multi, containing the ↵antirez2012-04-071-1/+2
| | | | length of the current pipeline. Test modified accordingly.
* Fixed typo in comment: "te" -> "the".antirez2012-03-291-1/+1
|
* Fix for slaves chains. Force resync of slaves (simply disconnecting them) ↵antirez2012-03-291-14/+15
| | | | when SLAVEOF turns a master into a slave.
* use server.unixtime instead of time(NULL) where possible (cluster.c not ↵Premysl Hruby2012-03-271-7/+6
| | | | checked though)
* Reclaim space from the client querybuf if needed.antirez2012-03-141-0/+2
|
* Process async client checks like client timeouts and BLPOP timeouts ↵antirez2012-03-131-28/+0
| | | | incrementally using a circular list.
* Added a qbuf-free field to CLIENT LIST output.antirez2012-03-131-1/+2
|
* Client creation time in redisClient structure. New age field in CLIENT LIST ↵antirez2012-03-131-2/+3
| | | | output.
* c->bufpos initialization moved for aesthetics.antirez2012-03-131-1/+1
|
* anetPeerToString() automatically populates ip/port with something that may ↵antirez2012-03-071-5/+1
| | | | be provided to the user as output in case of errors.
* Return ASAP from checkClientOutputBufferLimits() if c->reply_bytes is zero.antirez2012-02-161-1/+1
|
* Fixes to c->reply_bytes computation, and debug messages to closely study the ↵antirez2012-02-071-8/+22
| | | | behavior of memory pressure + slaves + maxmemory + blocked slaves.
* Precision of getClientOutputBufferMemoryUsage() greatily improved, see issue ↵antirez2012-02-071-8/+17
| | | | #327 for more information.
* freeMemoryIfNeeded() minor refactoringantirez2012-02-061-0/+21
|
* This fixes issue #327, is a very complex fix (unfortunately), details:antirez2012-02-041-3/+8
| | | | | | | | | | | | | | | | | | | | 1) sendReplyToClient() now no longer stops transferring data to a single client in the case we are out of memory (maxmemory-wise). 2) in processCommand() the idea of we being out of memory is no longer the naive zmalloc_used_memory() > server.maxmemory. To say if we can accept or not write queries is up to the return value of freeMemoryIfNeeded(), that has full control about that. 3) freeMemoryIfNeeded() now does its math without considering output buffers size. But at the same time it can't let the output buffers to put us too much outside the max memory limit, so at the same time it makes sure there is enough effort into delivering the output buffers to the slaves, calling the write handler directly. This three changes are the result of many tests, I found (partially empirically) that is the best way to address the problem, but maybe we'll find better solutions in the future.
* Use less memory when emitting the protocol, by using more shared objects for ↵antirez2012-02-041-0/+12
| | | | commonly emitted parts of the protocol.
* Fixed typo in getClientLimitClassByName()antirez2012-01-251-1/+1
|
* lenght -> lengthantirez2012-01-241-1/+1
|
* after all closing a client for output buffer limit overcoming is a WARNING ↵antirez2012-01-241-1/+1
| | | | level message.
* Client output buffer limits: configuration of parameters for the different ↵antirez2012-01-241-0/+16
| | | | classes of clients implemented.
* asyncCloseClientOnOutputBufferLimitReached() now ignores clients with ↵antirez2012-01-241-7/+5
| | | | REDIS_CLOSE_ASAP flag already set. Return value of the function changed from int to void since it is not used. Fixed logging of the client scheduled to be closed.
* client buffer handling refactoring and optimizationantirez2012-01-231-23/+47
|
* Implementation of the internals that make possible to terminate clients ↵antirez2012-01-231-0/+96
| | | | overcoming configured output buffer (soft and hard) limits.
* Introduced three client limit classes: normal, slave, pubsubantirez2012-01-171-0/+15
|
* Track the length of the client pending output buffers (still to transfer) in ↵antirez2012-01-171-1/+28
| | | | a new field in the client structure.
* On crash print information about the current client (if any), command ↵antirez2012-01-121-0/+6
| | | | vector, and object associated to first argument assuming it is a key.
* Protections against protocol desyncs, leading to infinite query buffer ↵antirez2011-12-311-6/+23
| | | | growing, due to nul-terms in specific bytes of the request or indefinitely long multi bulk or bulk count strings without newlines. This bug is related to Issue #141 as well.
* Fixed replication when multiple slaves are attaching at the same time. The ↵antirez2011-12-301-0/+10
| | | | output buffer was not copied correctly between slaves. This fixes issue #141.
* server.replstate -> server.repl_stateantirez2011-12-211-1/+1
|
* Fixed memleak in CLIENT INFO, added simple test that will work as regression ↵antirez2011-12-191-1/+5
| | | | test on mac os x and in the CI when running over valgrind. This fixes issue #256
* show initial querybuf bytes on querybuf overflow.antirez2011-11-281-2/+5
|
* log client protocol errors for log level >= verboseantirez2011-11-251-0/+6
|
* minor refactoring to networking.c adding a separated function to get a ↵antirez2011-11-241-8/+16
| | | | string representing the current state of all the connected clients.