Skip to content

Commit 2d16191

Browse files
remove log that caused segmentation fault when connection was nil (#311)
change order between initailizing the connections and starting the reconnection routine Signed-off-by: Dor.Katzelnick <Dor.Katzelnick@ibm.com>
1 parent b16549b commit 2d16191

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

node/router/shard_router.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ func (sr *ShardRouter) maybeReconnectStream(connIndex int, streamInConnIndex int
152152
sr.lock.RUnlock()
153153
sr.logger.Debugf("Checking stream %d,%d that was reported", connIndex, streamInConnIndex)
154154

155-
// check the connection, and if it's bad - try to reconnect untill success
156-
sr.logger.Debugf("connection %d has state %s", connIndex, conn.GetState())
155+
// check the connection, and if it's bad - try to reconnect until success
157156
if conn == nil || conn.GetState() == connectivity.Shutdown || conn.GetState() == connectivity.TransientFailure {
158157
if err = sr.reconnect(connIndex); err != nil {
159158
return err
@@ -218,8 +217,8 @@ func (sr *ShardRouter) reconnect(connIndex int) error {
218217

219218
func (sr *ShardRouter) MaybeInit() {
220219
sr.initConnPoolAndStreamsOnce()
221-
sr.startReconnectionRoutineOnce()
222220
sr.maybeConnect()
221+
sr.startReconnectionRoutineOnce()
223222
}
224223

225224
func (sr *ShardRouter) maybeConnect() {

0 commit comments

Comments
 (0)