-
Notifications
You must be signed in to change notification settings - Fork 60
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
fix issue #151: bind not restarting when user uses closeBind #152
base: master
Are you sure you want to change the base?
Conversation
closing it for now, the error message doesnt match the close reason. There seems to be a race condition between the unbind start and the tcp disconnect. Ill reopen when I resolve this issue. |
@@ -127,6 +129,8 @@ func (t *transceivable) Close() (err error) { | |||
if t.settings.OnClosed != nil { | |||
t.settings.OnClosed(ExplicitClosing) | |||
} | |||
|
|||
t.wg.Wait() | |||
} | |||
return | |||
} |
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.
Please update this function, reuse your nearly created closing
func (t *transceivable) Close() error {
t.closing(ExplicitClosing)
return nil
}
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.
Some tests were failing after recommended change. So I added a returned error to the new closing () func.
func (t *transceivable) Close() (err error) {
return t.closing(ExplicitClosing)
}
func (t *transceivable) closing(state State) (err error) {
if atomic.CompareAndSwapInt32(&t.aliveState, Alive, Closed) {
...
// close underlying conn
err = t.conn.Close()
...
}
return
}
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.
LGTM. Just a small comment.
I am sorry for replying late due to personal matter
When a pdu expires and the user returns true on closeBind, it should now call the close function with the proper state. This will allow OnClosed to be called and the bind to be restarted.
This also fixes the the transceiver context that is never closed.