Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
BIND
BIND
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 637
    • Issues 637
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 104
    • Merge Requests 104
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • ISC Open Source Projects
  • BINDBIND
  • Issues
  • #2256

Closed
Open
Opened Nov 09, 2020 by Ondřej Surý@ondrejOwner

Make the nmhandle attach/detach transparent

Currently, the netmgr callbacks need to manually attach/detach to the isc_nmhandle_t which makes the usage very error prone (it's fairly easy to forgot some weird path).

The code needs to be refactored, so the attach/detach is internal to the netmgr and not visible to the outside, e.g. instead of doing:

isc_nm_udpconnect(..., connect_cb, ...);

void
connect_cb(handle, ...) {
  isc_nmhandle_attach(handle, &read_handle);
  isc_nm_read(read_handle, read_cb, ...);
  isc_nmhandle_attach(handle, &send_handle);
  isc_nm_send(send_handle, send_cb, ...);
  isc_nmhandle_detach(&handle);
}

void
read_cb(handle, ...) {
  /* process data */
  isc_nmhandle_detach(&handle);
}

void
send_cb(handle, ...) {
  /* process */
  isc_nmhandle_detach(&handle);
}

we should just do:

isc_nm_udpconnect(..., connect_cb, ...);

void
connect_cb(handle, ...) {
  isc_nm_read(handle, read_cb, ...);
  isc_nm_send(handle, send_cb, ...);
}

void
read_cb(handle, ...) {
  /* process */
}

void
send_cb(handle, ...) {
  /* process */
}

Basically, the isc_nm_read(), isc_nm_send() and others needs to attach to the handle itself, and detach after calling the use supplied callback. It's probably going to be a little bit more complicated than that, but it should be fairly straightforward to fix all the paths in the code.

Edited Nov 09, 2020 by Ondřej Surý
Assignee
Assign to
February 2021 (9.11.28, 9.11.28-S1, 9.16.12, 9.16.12-S1, 9.17.10)
Milestone
February 2021 (9.11.28, 9.11.28-S1, 9.16.12, 9.16.12-S1, 9.17.10) (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: isc-projects/bind9#2256