Commit Graph

1065 Commits

Author SHA1 Message Date
michael-grunder
97679e57ba Retry poll(2) if we are intterupted.
This commit adds logic to retry our poll call when waiting for the
connection to complete, in the event that we are interrupted by a
signal.

Additionally we do some simple bookkeeping to keep track of the overall
timeout specified by the user.

Fixes #1206
2023-07-19 10:21:33 -07:00
V G
dedc6208b1 Fix a false positive warning of gcc 12+ -Werror=maybe-uninitialized 2023-07-14 08:37:31 -07:00
Romain Geissler
bff171c9fc Allow disabling the -Werror flag. 2023-07-13 11:27:05 -07:00
michael-grunder
d7a84df9ea Bump development SONAME. 2023-07-13 09:17:53 -07:00
Chayim
60e5075d4a
Version 1.2.0 (#1202)
Co-authored-by: Michael Grunder <michael.grunder@gmail.com>
2023-07-12 10:31:17 +03:00
Valentino Geron
adef139a75
Remove support in deprecated TLS versions 1.0 and 1.1 (#1205) 2023-07-12 09:20:56 +03:00
Yossi Gottlieb
d543baba67 Install major version symlink of shared objects.
This change addresses the issue discussed in #1202 and should make it
possible in the future to update minor versions without requiring
re-linking binaries.
2023-07-10 08:44:57 -07:00
windyakin
052f99ab2d Ensure functionality without _MSC_VER definition 2023-06-08 12:18:12 -07:00
Michael Grunder
ded32c7d1a
Add a test for the TCP_USER_TIMEOUT option. (#1192)
* Add a test for the TCP_USER_TIMEOUT option.
* Explicitly set errno to ENOTSUP on unsupported OS's
2023-06-01 09:09:11 -07:00
Yossi Gottlieb
5cbd1f2960
Add -Werror as a default. (#1193) 2023-06-01 19:03:24 +03:00
Yossi Gottlieb
af14456383
CI: Update homebrew Redis version. (#1191)
Fixes cross-compilation QEMU CI tests

* CI: Update homebrew Redis version.
* CI: Try apt-get update as a workaround.
2023-05-30 14:09:03 -07:00
Yossi Gottlieb
6de326e872 Fix a typo in b6a052f. 2023-05-30 14:05:28 -07:00
Viktor Söderqvist
b6a052fe09
Helper for setting TCP_USER_TIMEOUT socket option (#1188)
* Implement redisSetTcpUserTimeout to set socket option TCP_USER_TIMEOUT

* Documentation for redisSetTcpUserTimeout and some more undocumented functions

Documentation for redisReconnect() and the setters of socket options:

* redisKeepAlive()
* redisEnableKeepAliveWithInterval()
* redisSetTcpUserTimeout()
2023-05-29 13:25:34 -07:00
Ozan Tezcan
3fa9b69443
Add RedisModule adapter (#1182)
* Add RedisModule adapter
* add timer callback, add compatibility helper
2023-04-24 15:00:47 -07:00
Jacky Hu
d13c091e9f Fix wincrypt symbols conflict 2023-04-18 20:03:41 -07:00
michael-grunder
5d84c8cfdb Add a test ensuring we don't clobber connection error.
Adds a test that we don't attempt to set any socket timeout if the
connection itself failed.  This issue only seemed to occur on macOS but
it's nice to have a test for it.
2023-04-15 17:20:11 -07:00
michael-grunder
3f95fcdae4 Don't attempt to set a timeout if we are in an error state. 2023-04-14 23:02:01 -07:00
michael-grunder
aacb84b8d4 Fix typo in makefile. 2023-04-14 12:42:14 -07:00
Michael Grunder
563b062e37 Accept -nan per the RESP3 spec recommendation.
For reference:
https://github.com/redis/redis-specifications/blob/master/protocol/RESP3.md
2023-04-14 12:41:58 -07:00
Viktor Söderqvist
04c1b5b029 Fix colliding option values 2023-03-13 12:08:58 -07:00
michael-grunder
4ca8e73f66 Rework searching for openssl 2023-03-09 15:53:55 -08:00
Victor Polevoy
cd208812f9 Attempt to find the correct path for openssl.
The installation path for openssl may vary depending on the way
used for its installation and the macOS version.

This commit attempts to find the correct path for openssl to use.
2023-03-09 15:53:55 -08:00
michael-grunder
011f7093c0 Allow specifying the keepalive interval
Fixes #1155
2023-03-07 17:06:35 -08:00
autoantwort
e9243d4f70
Cmake static or shared (#1160)
* cmake: build either static or shared libs

* cmake: allow to build non-PIC static libs

* fix typo

* cmake: add ALIAS targets

* cmake: link to OpenSSL imported targets

CMake imported targets are more robust

* turn ENABLE_EXAMPLES to a CMake option

* fix typo

* install pdb files if shared

* fix hiredis_ssl-config file

* Fix more targets

* CMake knows when to enable CMAKE_POSITION_INDEPENDENT_CODE

* Restore setting of /Z7

* [ci] fix building of shared and static libs

* Apply suggestions from code review

Co-authored-by: Bjorn Svensson <bjorn.a.svensson@est.tech>

* Make it possible to change name of exported target

---------

Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com>
Co-authored-by: Bjorn Svensson <bjorn.a.svensson@est.tech>
2023-03-07 17:05:25 -08:00
Dominik Charousset
1cbd5bc762
Write a version file for the CMake package (#1165)
* Write a version file for the CMake package

> If no VERSION is given, the PROJECT_VERSION variable is used.

Since we set the project version to `${VERSION}`, we can safely skip
passing it to `write_basic_package_version_file` as well.
2023-02-24 11:42:18 -08:00
Till Krüss
6f5bae8c69 fix typo 2023-01-06 12:29:45 -08:00
Fabrice Fontaine
acd09461d3 CMakeLists.txt: respect BUILD_SHARED_LIBS
To allow building hiredis on toolchain without dynamic library support,
respect standard cmake BUILD_SHARED_LIBS:
https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-12-27 11:24:55 -08:00
Michael de Lang
97fcf0fd1a Add sdevent adapter 2022-12-21 15:55:54 -08:00
michael-grunder
ccff093bcd Bump dev version for the next release cycle. 2022-11-15 21:18:54 -08:00
michael-grunder
c14775b4e4 Prepare for v1.1.0 GA 2022-11-14 20:34:30 -08:00
filipe oliveira
f0bdf8405b
Add support for nan in RESP3 double (#1133) 2022-11-14 08:55:52 -08:00
Michael Grunder
991b0b0b31
Add an example that calls redisCommandArgv (#1140)
See #1138
2022-11-12 20:18:45 -08:00
Bjorn Svensson
a36686f84f
CI updates (#1139)
* Build CMake generated makefiles
* Simplify and update checkout
* Update CI workflow 'C/C++ CI'
* Some corrections of spelling and naming.
* Remove running on branch dev since not officially available.
2022-11-10 11:20:43 -08:00
dachui
8ad4985e9d fix flag reference 2022-11-09 21:17:59 -08:00
michael-grunder
7583ebb1b2 Make freeing a NULL redisAsyncContext a no op.
This makes our behavior consistent with redisFree and freeReplyObject.
2022-11-09 18:35:59 -08:00
michael-grunder
2c53dea7f9 Update version in dev branch. 2022-11-09 18:13:54 -08:00
michael-grunder
f063370edf Prepare for v1.1.0-rc1
- Update changelog.
- Bump version/soname defines.
2022-11-06 17:39:21 -08:00
michael-grunder
2b069573a5 CI fixes in preparation of release
- Upgrade to actions/checkout@v3 as node 12 is being phased out.
- Perform a manual dnf refresh on RockyLinux during setup.
- Switch to official cygwin/cygwin-install-action
2022-11-02 14:43:59 -07:00
michael-grunder
e1e9eb40db Add author information to release-drafter template. 2022-11-02 11:25:16 -07:00
bit0fun
afc29ee1a1 Update for mingw cross compile
- Used lowercase for Mstcpip.h as mingw will not find the file
	  otherwise
2022-10-26 18:09:00 -07:00
cqm
ceb8a8815e fixed cpp build error with adapters/libhv.h 2022-10-24 11:04:47 -07:00
Bjorn Svensson
3b15a04b59
Fixup of PR734: Coverage of hiredis.c (#1124)
Improve coverage (#734)

* Remove duplicate tests

- double covered by:
  "Can parse RESP3 doubles"
- bool covered via:
  "Can parse RESP3 bool"

* Make (connect) timeout in test config general

* Set error string in Unix connect with invalid timeout

Restructure testcase since redisConnectWithTimeout() and
redisConnectUnixWithTimeout() now behaves similar.

* Use quiet flag in lcov/genhtml instead of piping to /dev/null

* Fixup of redisCommandArgv test case

* Update test case to match what it covers

Use new test case info text since the previous one seemed copy&pasted.
The sought coverage was the handling of the parent-chaining
for a double object, which the test case now focuses on.

Co-authored-by: Ariel <ashtul@gmail.com>
2022-10-14 08:11:40 -07:00
Bjorn Svensson
c245df9fb9
CMake corrections for building on Windows (#1122)
* Replace use of newer CMake builtins than in v3.0.0

Visual Studio generator will replace -D with /D.

* Only use /Z7 flag on a Visual Studio compilator

Flag is not available on a GNU compilator running on windows,
like in a mingw64 setup.
2022-09-29 10:20:49 -07:00
michael-grunder
9c338a5981 Fix PUSH handler tests for Redis >= 7.0.5
Redis updated how invalidation push messages are sent to the client
after a FLUSHDB or FLUSHALL command.

See: redis/redis#8935
2022-09-27 14:33:26 -07:00
Bjorn Svensson
6d5c3ee74d
Install on windows fixes (#1117)
* Remove attempt to install .pdb file for windows static lib

From ff57c18b (#1054) the debug information was embedded in the
windows static lib rather than creating a .pdb file.
Removing the installation step of this file in CMake when building
with buildtype Debug or RelWithDebInfo.

* Embed debug information in windows hiredis_ssl_static lib

See ff57c18b (#1054) for same change in library hiredis_static.
2022-09-27 09:56:42 -07:00
Michael Grunder
68b29e1ad5
Add timeout support to libhv adapter. (#1109)
Add timeout support to libhv adapter.

See: #904
2022-09-21 15:10:37 -07:00
Bjorn Svensson
722e3409c7
Additional include directory given by pkg-config (#1118)
* Update include example in README

* Update pkg-config installed via CMake

Gives the include directory to enable the use of:
 #include <hiredis/hiredis.h>

but keeps the existing include dir. for backwards compatibility.

Example:
> pkg-config hiredis --cflags
-D_FILE_OFFSET_BITS=64 -I/usr/local/include/hiredis -I/usr/local/include

* Update pkg-config installed via Make

Gives the include directory to enable the use of:
  #include <hiredis/hiredis.h>
but keeps the existing include path for backwards compatibility.

Example:
> pkg-config hiredis --cflags
-D_FILE_OFFSET_BITS=64 -I/usr/local/include/hiredis -I/usr/local/include
2022-09-19 10:49:55 -07:00
Björn Svensson
bd9ccb8c47 Use __attribute__ when building with clang on windows
Since clang supports __attribute__ we can avoid disabling
it and use packed sdshdr structs. This also make sure we dont
affect subsequent header files that require __attribute__.

Note:
Clang attempts to be compatible with MSVC and defines _MSC_VER
2022-09-14 16:56:41 -07:00
Vlad Turchenko
5392adc265 set default SSL certificate directory 2022-09-08 14:02:29 -07:00
michael-grunder
560e664862 Minor refactor
Protect against a NULL pointer dereference, and remove unused write
to a variable.
2022-09-08 11:18:43 -07:00