1. 26 Jun, 2022 3 commits
  2. 26 Jul, 2020 1 commit
  3. 22 Jun, 2020 1 commit
  4. 07 Jun, 2020 1 commit
  5. 22 May, 2020 1 commit
    • Michael Grunder's avatar
      Allow users to replace allocator and handle OOM everywhere. (#800) · 8e0264cf
      Michael Grunder authored
      * Adds an indirection to every allocation/deallocation to allow users to 
        plug in ones of their choosing (use custom functions, jemalloc, etc).
      
      * Gracefully handle OOM everywhere in hiredis.  This should make it possible
        for users of the library to have more flexibility in how they handle such situations.
      
      * Changes `redisReaderTask->elements` from an `int` to a `long long` to prevent
        a possible overflow when transferring the task elements into a `redisReply`.
      
      * Adds a configurable `max elements` member to `redisReader` that defaults to
        2^32 - 1.  This can be set to "unlimited" by setting the value to zero.
      8e0264cf
  6. 03 Apr, 2020 1 commit
    • Michael Grunder's avatar
      Win32 tests and timeout fix (#776) · cc9d0329
      Michael Grunder authored
      Unit tests in Windows and a Windows timeout fix
      
      This commit gets our unit tests compiling and running on Windows as well as removes a duplicated `timeval` -> `DWORD` conversion logic in sockcompat.c 
      
      There are minor differences in behavior between Linux and Windows to note:
      
      1.  In Windows, opening a non-existent hangs forever in WSAPoll whereas
          it correctly returns with a "Connection refused" error on Linux.
          For that reason, I simply skip this test in Windows.
      
          It may be related to this known issue:
          https://daniel.haxx.se/blog/2012/10/10/wsapoll-is-broken/
      
      2.  Timeouts are handled slightly differently in Windows and Linux.  
          In Linux, we intentionally set REDIS_ERR_IO for connection
          timeouts whereas in Windows we set REDIS_ERR_TIMEOUT.  It may be
          prudent to fix this discrepancy although there are almost certainly
          users relying on the current behavior.
      cc9d0329
  7. 28 Jan, 2020 1 commit
  8. 12 Aug, 2019 2 commits
  9. 03 Jul, 2019 1 commit
  10. 01 Apr, 2019 4 commits
    • m's avatar
      Port network layer to Winsock · dc6d19b9
      m authored
      With this change, Hiredis builds with MinGW and runs on Windows.
      dc6d19b9
    • m's avatar
      Use recv/send instead of read/write · 1d092a23
      m authored
      The recv/send calls are more portable than read/write, since unlike the
      latter, the former work with Windows sockets.
      
      We also check for EWOULDBLOCK instead of EAGAIN. On most Unices, EAGAIN
      and EWOULDBLBOCK are the same thing. However, on Windows they are
      different, and send/recv are expected to give EWOULDBLOCK for
      non-blocking sockets.
      1d092a23
    • m's avatar
      Introduce a redisFD type · e84086cb
      m authored
      The redisFD type should be equal to the system native socket file
      desciptor type (for POSIX, this is a plain int).
      
      We also introduce the REDIS_INVALID_FD value, which maps to -1 on POSIX
      systems.
      e84086cb
    • m's avatar
      Move network I/O calls to net.c · 1788f41f
      m authored
      This makes hiredis.c free from system calls related to socket I/O. This
      is also makes the treatment of raw socket connections more similar to
      the SSL backend.
      1788f41f
  11. 20 Feb, 2019 2 commits
  12. 28 Jan, 2019 1 commit
  13. 05 Dec, 2018 1 commit
  14. 26 Sep, 2018 3 commits
  15. 01 May, 2018 3 commits
  16. 28 Apr, 2018 2 commits
    • Justin Brewer's avatar
      Strip down fmacros.h · 49bbaacc
      Justin Brewer authored
      
      
      strerror_r and addrinfo require _POSIX_C_SOURCE >= 200112L,  which is
      implied by _XOPEN_SOURCE >= 600. With the removal of AF_LOCAL usage,
      the only non-standard features being used are the TCP_KEEP* socket
      flags. _DARWIN_C_SOURCE is required to expose TCP_KEEPALIVE.
      
      Fall back to using _XOPEN_SOURCE 600 for all platforms, and
      additionally define _DARWIN_C_SOURCE for Darwin.
      Signed-off-by: default avatarJustin Brewer <jzb0012@auburn.edu>
      49bbaacc
    • Justin Brewer's avatar
      Use AF_UNIX · bbeab800
      Justin Brewer authored
      
      
      AF_LOCAL is the old, non-standardized name for AF_UNIX. Just use
      AF_UNIX, rather than wrestling with platform specifics of AF_LOCAL
      definitions.
      Signed-off-by: default avatarJustin Brewer <jzb0012@auburn.edu>
      bbeab800
  17. 15 Jun, 2017 1 commit
  18. 15 May, 2017 1 commit
  19. 30 Dec, 2016 1 commit
  20. 07 Jul, 2016 1 commit
  21. 18 Nov, 2015 1 commit
    • Tom Lee's avatar
      Fix potential race in 'invalid timeout' tests · d4b715f0
      Tom Lee authored
      It's possible for the call to connect() to succeed on the very first
      try, in which case the logic for checking for invalid timeout fields is
      never executed. When this happens, the tests fail because they expect a
      REDIS_ERR_IO but no such failure has occurred.
      
      Tests aside, this is a potential source of irritating and hard-to-find
      intermittent bugs.
      
      This patch forces the validation to occur early so that we get
      predictable behavior whenever an invalid timeout is specified.
      d4b715f0
  22. 30 Apr, 2015 1 commit
    • Alex Balashov's avatar
      Renamed redisContext struct member 'unix' to 'unix_sock' to avoid encountering... · d132d676
      Alex Balashov authored
      Renamed redisContext struct member 'unix' to 'unix_sock' to avoid encountering defined constant 'unix' in GNU C environment (see commit d8145d79).
      
      Not all code using hiredis can compile using '-std=c99', and/or not all users are able to easily make that change to the build process of various open-source projects, so it is more pragmatic to choose a different identifier that does not impose this requirement.
      d132d676
  23. 16 Apr, 2015 2 commits
  24. 05 Jan, 2015 3 commits
    • Matt Stancliff's avatar
      Fix errno error buffers to not clobber errors · cc202324
      Matt Stancliff authored
      The strerror_r API has two flavors depending on system options.
      
      The bad flavor uses a static buffer for returning results, so if
      you save the pointer from strerror_r, the string you're referencing
      becomes useless if anybody else calls strerror_r again
      
      The good flavor does what you expect: it writes the error to your buffer.
      
      This commit uses strerror_r directly if it's a good version or copies
      the static buffer into our private buffer if it's a bad version.
      
      Thanks to gemorin for explaining the problem and drafting a fix.
      
      Fixes #239
      cc202324
    • Chris Lamb's avatar
      Fix build under kfreebsd · 85c6bfb0
      Chris Lamb authored
      
      Signed-off-by: default avatarChris Lamb <chris@chris-lamb.co.uk>
      
      [Instead of checking for "not solaris" we feature detect
      for availability of what we want, then remove the system
      that advertises compatability but doesn't actually provide it
      (given our assumptions about what we're guarding).]
      
      Closes #254
      85c6bfb0
    • mike's avatar
      Add support for SO_REUSEADDR · 7c4d2557
      mike authored
      [This introduces some new API functions.]
      
      * Adds new flag to the connection context indicating SO_REUSEADDR
        should be set.
      * Adds max number of retries constant for when connect() hits
        EADDRNOTAVAIL.
      * Adds new function, redisAsyncConnectBindWithReuse(), letting
        clients enable this functionality.
      
      [Removed trailing whitespace in new header lines.]
      
      Closes #264
      7c4d2557
  25. 18 Sep, 2014 1 commit