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
redis
Commits
18b59f35
Unverified
Commit
18b59f35
authored
Mar 16, 2021
by
Wen Hui
Committed by
GitHub
Mar 16, 2021
Browse files
Sentinel: fix potential NULL ptr issue for sentinel instance connection (#8627)
parent
40d555db
Changes
1
Show whitespace changes
Inline
Side-by-side
src/sentinel.c
View file @
18b59f35
...
@@ -2423,8 +2423,10 @@ void sentinelReconnectInstance(sentinelRedisInstance *ri) {
...
@@ -2423,8 +2423,10 @@ void sentinelReconnectInstance(sentinelRedisInstance *ri) {
/* Commands connection. */
/* Commands connection. */
if (link->cc == NULL) {
if (link->cc == NULL) {
link->cc = redisAsyncConnectBind(ri->addr->ip,ri->addr->port,NET_FIRST_BIND_ADDR);
link->cc = redisAsyncConnectBind(ri->addr->ip,ri->addr->port,NET_FIRST_BIND_ADDR);
if
(
!
link
->
cc
->
err
)
anetCloexec
(
link
->
cc
->
c
.
fd
);
if (link->cc && !link->cc->err) anetCloexec(link->cc->c.fd);
if
(
!
link
->
cc
->
err
&&
server
.
tls_replication
&&
if (!link->cc) {
sentinelEvent(LL_DEBUG,"-cmd-link-reconnection",ri,"%@ #Failed to establish connection");
} else if (!link->cc->err && server.tls_replication &&
(instanceLinkNegotiateTLS(link->cc) == C_ERR)) {
(instanceLinkNegotiateTLS(link->cc) == C_ERR)) {
sentinelEvent(LL_DEBUG,"-cmd-link-reconnection",ri,"%@ #Failed to initialize TLS");
sentinelEvent(LL_DEBUG,"-cmd-link-reconnection",ri,"%@ #Failed to initialize TLS");
instanceLinkCloseConnection(link,link->cc);
instanceLinkCloseConnection(link,link->cc);
...
@@ -2451,8 +2453,10 @@ void sentinelReconnectInstance(sentinelRedisInstance *ri) {
...
@@ -2451,8 +2453,10 @@ void sentinelReconnectInstance(sentinelRedisInstance *ri) {
/* Pub / Sub */
/* Pub / Sub */
if ((ri->flags & (SRI_MASTER|SRI_SLAVE)) && link->pc == NULL) {
if ((ri->flags & (SRI_MASTER|SRI_SLAVE)) && link->pc == NULL) {
link->pc = redisAsyncConnectBind(ri->addr->ip,ri->addr->port,NET_FIRST_BIND_ADDR);
link->pc = redisAsyncConnectBind(ri->addr->ip,ri->addr->port,NET_FIRST_BIND_ADDR);
if
(
!
link
->
pc
->
err
)
anetCloexec
(
link
->
pc
->
c
.
fd
);
if (link->pc && !link->pc->err) anetCloexec(link->pc->c.fd);
if
(
!
link
->
pc
->
err
&&
server
.
tls_replication
&&
if (!link->pc) {
sentinelEvent(LL_DEBUG,"-pubsub-link-reconnection",ri,"%@ #Failed to establish connection");
} else if (!link->pc->err && server.tls_replication &&
(instanceLinkNegotiateTLS(link->pc) == C_ERR)) {
(instanceLinkNegotiateTLS(link->pc) == C_ERR)) {
sentinelEvent(LL_DEBUG,"-pubsub-link-reconnection",ri,"%@ #Failed to initialize TLS");
sentinelEvent(LL_DEBUG,"-pubsub-link-reconnection",ri,"%@ #Failed to initialize TLS");
} else if (link->pc->err) {
} else if (link->pc->err) {
...
...
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