-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qfix: begin should correctly handle reselect #1485
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: denis-tingaikin <[email protected]>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1485 +/- ##
=======================================
Coverage ? 70.38%
=======================================
Files ? 248
Lines ? 11197
Branches ? 0
=======================================
Hits ? 7881
Misses ? 2815
Partials ? 501 ☔ View full report in Codecov by Sentry. |
68262cf
to
35600c5
Compare
eventFactoryServer.request != nil && eventFactoryServer.request.Connection != nil { | ||
log.FromContext(ctx).Info("Closing connection due to RESELECT_REQUESTED state") | ||
_, closeErr := next.Server(withEventFactoryCtx).Close(withEventFactoryCtx, eventFactoryServer.request.Connection) | ||
if closeErr != nil { | ||
log.FromContext(ctx).Errorf("Can't close old connection: %v", closeErr) | ||
} else { | ||
request.GetConnection().State = networkservice.State_UP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we should set State_UP
after closing.
Maybe State_DOWN
?
It may also be worth moving eventFactoryServer.state
into else
block. In this case we can left eventFactoryServer.state == established
condition:
if eventFactoryServer.state == established &&
request.GetConnection().GetState() == networkservice.State_RESELECT_REQUESTED &&
eventFactoryServer.request != nil && eventFactoryServer.request.Connection != nil {
log.FromContext(ctx).Info("Closing connection due to RESELECT_REQUESTED state")
_, closeErr := next.Server(withEventFactoryCtx).Close(withEventFactoryCtx, eventFactoryServer.request.Connection)
if closeErr != nil {
log.FromContext(ctx).Errorf("Can't close old connection: %v", closeErr)
} else {
request.GetConnection().State = networkservice.State_DOWN
eventFactoryServer.state = closed
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- we may lost eventFactoryServer.state == established
- we don't need to request a networkservice with DOWN state if we closed previous connection
Description
Issue link
Fixes networkservicemesh/integration-k8s-kind#845
How Has This Been Tested?
Types of changes