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

TAPA; sync interface name cache for recovered connections #448

Merged
merged 1 commit into from
Aug 22, 2023

Conversation

zolug
Copy link
Collaborator

@zolug zolug commented Aug 3, 2023

Description

Related to #444

In case of a connection recovered through NSM's connection monitor, the so called interface name cache in interfaceNameClient could have become out of sync.
That's because the cache was not contacted in such cases, thus upon a faulty Close() or TAPA crash the cache failed to keep track of recovered names. (Which means, such names could be re-used by some other connection.)

Therefor, move the interface name of recovered connections from Mechanism to MechanismPreferences, so that intefaceNameClient could handle such connection requests properly.
If the inteface name is not yet taken by some other connection, then use it, and also update the inteface name cache if needed. (But generate a new name if already taken by another connection.)

Issue link

Checklist

  • Purpose
    • Bug fix
    • New functionality
    • Documentation
    • Refactoring
    • CI
  • Test
    • Unit test
    • E2E Test
    • Tested manually
  • Introduce a breaking change
    • Yes (description required)
    • No

In case of a connection recovered through NSM's connection monitor,
the so called interface name cache in interfaceNameClient could have
become out of sync.
That's because the cache was not contacted in such cases, thus upon
a faulty Close() or TAPA crash the cache failed to keep track of
recovered names. (Which means, such names could be re-used by some other
connection.)

Therefor, move the interface name of recovered connections from Mechanism
to MechanismPreferences, so that intefaceNameClient could handle such
connection requests properly.
If the inteface name is not yet taken by some other connection, then use it,
and also update the inteface name cache if needed. (But generate a new name
if already taken by another connection.)

if _, ok := cg.usedNames[name]; ok {
// already taken
return os.ErrExist
Copy link
Member

Choose a reason for hiding this comment

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

This error will return "file already exists" (https://github.com/golang/go/blob/master/src/os/error.go#L22).

Suggested change
return os.ErrExist
return fmt.Errorf("name already in use")

@zolug zolug merged commit 1ca14e4 into master Aug 22, 2023
@zolug zolug deleted the ezollug-conn-mon3 branch November 6, 2023 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants