Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
dc3c6ce8
Commit
dc3c6ce8
authored
Apr 10, 2019
by
Mark Nunberg
Browse files
build ssl example if ssl is enabled
parent
4830786c
Changes
2
Hide whitespace changes
Inline
Side-by-side
examples/CMakeLists.txt
View file @
dc3c6ce8
...
...
@@ -37,5 +37,10 @@ IF (APPLE)
TARGET_LINK_LIBRARIES
(
example-macosx hiredis
${
CF
}
)
ENDIF
()
IF
(
HIREDIS_SSL
)
ADD_EXECUTABLE
(
example-ssl example-ssl.c
)
TARGET_LINK_LIBRARIES
(
example-ssl hiredis
)
ENDIF
()
ADD_EXECUTABLE
(
example example.c
)
TARGET_LINK_LIBRARIES
(
example hiredis
)
\ No newline at end of file
examples/example-ssl.c
View file @
dc3c6ce8
...
...
@@ -18,8 +18,12 @@ int main(int argc, char **argv) {
const
char
*
key
=
argv
[
4
];
const
char
*
ca
=
argc
>
4
?
argv
[
5
]
:
NULL
;
struct
timeval
timeout
=
{
1
,
500000
};
// 1.5 seconds
c
=
redisConnectWithTimeout
(
hostname
,
port
,
timeout
);
struct
timeval
tv
=
{
1
,
500000
};
// 1.5 seconds
redisOptions
options
=
{
0
};
REDIS_OPTIONS_SET_TCP
(
&
options
,
hostname
,
port
);
options
.
timeout
=
&
tv
;
c
=
redisConnectWithOptions
(
&
options
);
if
(
c
==
NULL
||
c
->
err
)
{
if
(
c
)
{
printf
(
"Connection error: %s
\n
"
,
c
->
errstr
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment