-
Notifications
You must be signed in to change notification settings - Fork 12
fix: orb-agent docker image restart #271
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6271f33
fix: orb-agent docker image restart
leoparente f27555c
small fixes
leoparente 07c9db1
socket impl
leoparente 7c9f4cf
avoid infinity loop
leoparente 3446c9a
reset
leoparente c0a223d
add tini
leoparente b3b758c
go mod tidy
leoparente 4b80d48
Merge remote-tracking branch 'origin/develop' into fix/OBS-1672-restart
leoparente 395db7e
Update cmd/main.go
leoparente a55e510
preserve run
leoparente File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| //go:build unix | ||
|
|
||
| package otlpbridge | ||
|
|
||
| import ( | ||
| "context" | ||
| "net" | ||
| "syscall" | ||
|
|
||
| "golang.org/x/sys/unix" | ||
leoparente marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ) | ||
|
|
||
| // newListenConfig returns a net.ListenConfig with SO_REUSEADDR enabled for faster port reuse. | ||
| // This is particularly important for docker restart scenarios where ports may be in TIME_WAIT. | ||
| func newListenConfig() net.ListenConfig { | ||
| return net.ListenConfig{ | ||
| Control: func(_, _ string, c syscall.RawConn) error { | ||
| var sockOptErr error | ||
| if err := c.Control(func(fd uintptr) { | ||
| // Enable SO_REUSEADDR to allow binding to TIME_WAIT sockets | ||
| sockOptErr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEADDR, 1) | ||
| }); err != nil { | ||
| return err | ||
| } | ||
| return sockOptErr | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| // listen creates a TCP listener with platform-specific socket options. | ||
| func listen(ctx context.Context, addr string) (net.Listener, error) { | ||
| lc := newListenConfig() | ||
| return lc.Listen(ctx, "tcp", addr) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| //go:build windows | ||
|
|
||
| package otlpbridge | ||
|
|
||
| import ( | ||
| "context" | ||
| "net" | ||
| ) | ||
|
|
||
| // listen creates a TCP listener using standard net.Listen. | ||
| // Windows doesn't need SO_REUSEADDR configuration like Unix systems do. | ||
| func listen(ctx context.Context, addr string) (net.Listener, error) { | ||
| // On Windows, we use standard Listen without SO_REUSEADDR | ||
| // Windows handles port reuse differently and doesn't have the same TIME_WAIT issues | ||
| var lc net.ListenConfig | ||
| return lc.Listen(ctx, "tcp", addr) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.