Skip to content
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

initial memberlist.Transport implementation allowing us to use an upgrader for ListenTCP/ListenUDP #7

Merged
merged 6 commits into from
Feb 15, 2023

Conversation

amery
Copy link
Contributor

@amery amery commented Feb 10, 2023

No description provided.

transport/tcp.go Outdated Show resolved Hide resolved
cluster.go Show resolved Hide resolved
transport/tcp.go Outdated
WithField(RemoteAddrLabel, conn.RemoteAddr()).
Print("Connection Terminated")

break
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this break do really what you want? Didn't you mean:

mainfor:for {
....
break mainfor
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, but what about using return instead? @karasz

transport/tcp.go Outdated Show resolved Hide resolved
transport/udp.go Outdated Show resolved Hide resolved
transport/tcp.go Outdated Show resolved Hide resolved
transport/tcp.go Outdated
// continue
case <-ctx.Done():
// sorry pal, we are cancelled
defer conn.Close()
Copy link
Collaborator

@karasz karasz Feb 15, 2023

Choose a reason for hiding this comment

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

defer in for is calling for trouble afaik
maybe

                                -defer conn.Close-
				t.error(ctx.Err()).
					WithField(ListenerAddrLabel, ln.Addr()).
					WithField(RemoteAddrLabel, conn.RemoteAddr()).
					Print("Connection Terminated")
                                +conn.Close()+
				break

Copy link
Contributor Author

Choose a reason for hiding this comment

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

combined with return becomes more explicit that it only happens once

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is still not fixed, line 60 is unchanged

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not in a loop because there is a return right after

Copy link
Collaborator

@karasz karasz left a comment

Choose a reason for hiding this comment

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

Other than what was commented this LGTM

@amery
Copy link
Contributor Author

amery commented Feb 15, 2023

amended. also updated it to use the new slog/handlers/discard instead of slog/noop @karasz

Copy link
Collaborator

@karasz karasz left a comment

Choose a reason for hiding this comment

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

LGTM now

@amery amery merged commit 519b520 into main Feb 15, 2023
@amery amery deleted the pr-amery-transport branch February 15, 2023 15:41
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.

None yet

2 participants