Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use net.ErrClosed#303

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nhooyr merged 1 commit intocoder:devfromemersion:err-closed
Oct 13, 2023
Merged

Use net.ErrClosed#303

nhooyr merged 1 commit intocoder:devfromemersion:err-closed
Oct 13, 2023

Conversation

emersion
Copy link
Contributor

Go 1.16 has introduced net.ErrClosed, which should be returned/wrapped when an
I/O call is performed on a network connection which has already been closed.
This is useful to avoid cluttering logs with messages like "failed to close
WebSocket: already wrote close".

Closes:#286

corny, elnappo, dvcorreia, and AuroraTea reacted with thumbs up emoji
@emersionemersion requested a review fromnhooyr as acode ownerMay 19, 2021 21:53
@emersionemersionforce-pushed theerr-closed branch 2 times, most recently from99ea4f2 tob509f6bCompareMay 19, 2021 21:54
@Antonboom
Copy link

Like!

@emersion
Copy link
ContributorAuthor

Hi@nhooyr, any chance to get this reviewed? Thanks!

@emersion
Copy link
ContributorAuthor

Ping@nhooyr, would you have the time to have a look?

Antonboom and corny reacted with thumbs up emoji

@nhooyr
Copy link
Contributor

Sorry for the delay I'm on a rather long sabbatical right now. Will review when I'm back by the end of this month!

@emersion
Copy link
ContributorAuthor

Cool! No problem, take your time :)

@Antonboom
Copy link

Any news?

@emersion
Copy link
ContributorAuthor

Hi again@nhooyr, any chance to get this reviewed?

Antonboom reacted with thumbs up emoji

Copy link

@bokunodevbokunodev left a comment

Choose a reason for hiding this comment

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

bothclose__go113.go andclose__go116.go has build tag
// +build !go1.16

@emersion
Copy link
ContributorAuthor

One is missing a!.

@nhooyr
Copy link
Contributor

Hi again@nhooyr, any chance to get this reviewed?

Sorry@emersion my sabbatical continues until at least mid October. Apologies for the delay and the broken promise above but I'm dealing with some personal stuff right now and was hoping to be back sooner.

I could merge this as is into master as I don't see anything wrong with it but I can't do any sort of release without dealing with#256 first which will take substantial effort. So I'd prefer to leave this PR open as is until I'm back.

@emersion
Copy link
ContributorAuthor

Apologies for the delay and the broken promise above but I'm dealing with some personal stuff right now and was hoping to be back sooner.

No problem, thanks for having a look.

I could merge this as is into master as I don't see anything wrong with it but I can't do any sort of release without dealing with#256 first which will take substantial effort. So I'd prefer to leave this PR open as is until I'm back.

I'd personally prefer for this to be merged so that I can upgrade to the latest commit even if there's no release yet. But up to you!

@emersion
Copy link
ContributorAuthor

Hi@nhooyr, is it possible to merge this?

Antonboom reacted with thumbs up emoji

@emersion
Copy link
ContributorAuthor

Gentle ping

Antonboom reacted with thumbs up emoji

@emersion
Copy link
ContributorAuthor

@nhooyr, any chance to get this merged?

Antonboom, corny, and falmar reacted with laugh emojiJKJameson reacted with confused emoji

@falmarfalmar mentioned this pull requestDec 23, 2022
@emersion
Copy link
ContributorAuthor

Hi, any news about this?

Antonboom and JKJameson reacted with thumbs up emoji

Copy link
Contributor

@nhooyrnhooyr left a comment

Choose a reason for hiding this comment

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

Will get this merged in after#256

write.go Outdated
func (mw*msgWriter)Write(p []byte) (int,error) {
ifmw.closed {
return0,errors.New("cannot use closed writer")
return0,errClosed
Copy link
Contributor

Choose a reason for hiding this comment

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

These two are separate errors and should remain. They aren't the same asnet.ErrClosed.

write.go Outdated
func (mw*msgWriter)Close()error {
ifmw.closed {
returnerrors.New("cannot use closed writer")
returnerrClosed
Copy link
Contributor

Choose a reason for hiding this comment

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

.

@emersion
Copy link
ContributorAuthor

Hm, why is that?net.Conn returnsnet.ErrClosed when attempting to write or close an already-closed connection.

@nhooyr
Copy link
Contributor

Hm, why is that? net.Conn returns net.ErrClosed when attempting to write or close an already-closed connection.

Neither of those are closed connections, they're readers and writers for a single frame. There's only the one spot inclose_notjs.go where it's correctly used when the connection is already closed.

@emersion
Copy link
ContributorAuthor

Ah, I see, that makes sense! Fixed.

@rslobodian
Copy link

+1 to this PR :)

AuroraTea reacted with thumbs up emoji

@AuroraTea
Copy link

Can this thing go any further?
Really needs it.
At least the original error should be exported.
😥

@nhooyrnhooyr changed the base branch frommaster todevOctober 13, 2023 05:19
Go 1.16 has introduced net.ErrClosed, which should be returned/wrapped when anI/O call is performed on a network connection which has already been closed.This is useful to avoid cluttering logs with messages like "failed to closeWebSocket: already wrote close".Closes:coder#286
@nhooyr
Copy link
Contributor

Sorry for the delays, thanks@emersion

AuroraTea reacted with laugh emoji

@nhooyrnhooyr mentioned this pull requestOct 13, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
2 more reviewers

@bokunodevbokunodevbokunodev left review comments

@nhooyrnhooyrnhooyr approved these changes

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Use net.ErrClosed
6 participants
@emersion@Antonboom@nhooyr@rslobodian@AuroraTea@bokunodev

[8]ページ先頭

©2009-2025 Movatter.jp