Skip to content

Conversation

@aarshkshah1992
Copy link
Contributor

No description provided.


ids.handleIdentifyResponse(s)
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^

func (ids *IDService) pushHandler(s network.Stream) {
s.SetReadDeadline(time.Now().Add(StreamReadTimeout))

ids.handleIdentifyResponse(s)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we already set a read deadline in this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have fixed this.


// deltaHandler handles incoming delta updates from peers.
func (ids *IDService) deltaHandler(s network.Stream) {
s.SetReadDeadline(time.Now().Add(StreamReadTimeout))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to explicitly ignore the error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done.

}

func (ids *IDService) handleIdentifyResponse(s network.Stream) {
func (ids *IDService) handleIdentifyResponse(s network.Stream) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we returning an error now? There isn't much we can do about it and we appear to always ignore it.

Copy link
Contributor Author

@aarshkshah1992 aarshkshah1992 Dec 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Stebalien

This is to ensure that we publish an EvtPeerIdentificationCompleted only if the stream read was successful. If the stream read fails, say because of a timeout, we want to publish an EvtPeerIdentificationFailed event.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. We should be returning an error from consumeMessage in that case.

}

func (ids *IDService) sendIdentifyResp(s network.Stream) {
s.SetDeadline(time.Now().Add(StreamReadTimeout))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: using the read timeout here is a bit strange, this mostly applies to writes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, had put in just in case. Have removed it.

Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on which PR gets merged first (this one or #1033), we might need to set the context for OpenStream here.

@aarshkshah1992
Copy link
Contributor Author

@Stebalien Have pushed the changes.

}

func (ids *IDService) handleIdentifyResponse(s network.Stream) {
func (ids *IDService) handleIdentifyResponse(s network.Stream) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. We should be returning an error from consumeMessage in that case.

@aarshkshah1992 aarshkshah1992 merged commit 1c850e1 into master Jan 14, 2021
@aarshkshah1992 aarshkshah1992 deleted the fix/id-timeout branch January 14, 2021 06:17
@Stebalien Stebalien mentioned this pull request May 11, 2021
27 tasks
@aschmahmann aschmahmann mentioned this pull request May 14, 2021
71 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants