-
Notifications
You must be signed in to change notification settings - Fork 17
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
Handle network errors/stalls #101
Conversation
Handle errors when network messages don't go through
lint, remove unused status
@@ -33,3 +33,9 @@ const ErrRejected = errorType("response rejected") | |||
|
|||
// ErrUnsupported indicates an operation is not supported by the transport protocol | |||
const ErrUnsupported = errorType("unsupported") | |||
|
|||
// ErrDisconnected indicates the other peer may have hung up and you should try restarting the channel. |
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.
@hannahhoward For my own curiosity:
What's the advantage of defining:
type errorType string
func (e errorType) Error() string {
return string(e)
}
rather than using errors.New()
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.
it allows you to use const
instead of var
-- there is a danger of var
being changed -- technically anyone using the module can do so.
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.
@hannahhoward Great stuff ! Really learn a lot from you simplify things.
Just one review comment.
@@ -170,12 +168,42 @@ func (m *manager) OnRequestTimedOut(ctx context.Context, chid datatransfer.Chann | |||
go func() { | |||
select { | |||
case <-ctx.Done(): | |||
case <-time.After(ChannelRemoveTimeout): | |||
case <-time.After(m.channelRemoveTimeout): | |||
channel, err := m.channels.GetByID(ctx, chid) |
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.
What happens if a channel times/out disconnects and then the FSM/data-trasfer crashes ? I think we should have a handler for this state that starts this wait even when the FSM restarts. Does that make sense ?
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.
yea we can address this when we have a better way to actually track disconencts other than the Message -- see comment above about challenges of essentially pushing state
Goals
Using ipfs/go-graphsync#102, provide better information about what's going on with a request and when it stalls.
Implementation