Skip to content

Use allocate with session to automatically clean up IPs.#1544

Merged
jglogan merged 1 commit into
apple:mainfrom
jglogan:remove-deallocate
May 12, 2026
Merged

Use allocate with session to automatically clean up IPs.#1544
jglogan merged 1 commit into
apple:mainfrom
jglogan:remove-deallocate

Conversation

@jglogan
Copy link
Copy Markdown
Contributor

@jglogan jglogan commented May 11, 2026

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Fix bug and simplify IP allocation.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

- Removes network plugin `deallocate()`, and allocate
  takes an `XPCServerSession` that registers an
  `onDisconnect` handler that performs deallocation.
- ContainerService now tracks `networkSessions` for
  allocations.
@github-actions
Copy link
Copy Markdown

Code Coverage

Tier Line Coverage
Unit 33.24%
Integration 20.42%
Combined 53.08%

private let log: Logger
private var allocator: AttachmentAllocator
private var macAddresses: [UInt32: MACAddress]
private var allocationsBySession: [XPCServerSession: [(hostname: String, index: UInt32)]] = [:]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

small, small nit but could we set this default value in the init for consistency?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure! I'll fix in the third PR.

@jglogan jglogan merged commit c56a659 into apple:main May 12, 2026
4 checks passed
@jglogan jglogan deleted the remove-deallocate branch May 12, 2026 06:08
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.

2 participants