Skip to content
Snippets Groups Projects

Draft: missed to test return code of bind()

Merged Thomas Laurent requested to merge rfsim-bug-multi-listners into develop
2 unresolved threads

when we start 2 nodes with rfsim, on same machine and same TCP port, the second bind() fails silently So, the second listen() uses a random port number this commit adds a assert to stop the process

Merge request reports

Checking pipeline status.

Approval is optional

Merged by Robert SchmidtRobert Schmidt 2 years ago (Nov 9, 2022 5:40am UTC)

Merge details

  • Changes merged into develop with 0cacf29d.
  • Deleted the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
547 547 sin_addr:
548 548 { s_addr: INADDR_ANY }
549 549 };
550 bind(t->listen_sock, (struct sockaddr *)&addr, sizeof(addr));
550 AssertFatal(bind(t->listen_sock, (struct sockaddr *)&addr, sizeof(addr))==0,"");
  • Optional: It would be better to decouple function call and assert, and to give a helpful message, something like (untested!):

    Suggested change
    550 AssertFatal(bind(t->listen_sock, (struct sockaddr *)&addr, sizeof(addr))==0,"");
    550 int rc = bind(t->listen_sock, (struct sockaddr *)&addr, sizeof(addr));
    551 AssertFatal(rc == 0, "bind failed: errno %d, %s", errno, strerror(errno));
  • Arash Sahbafard changed this line in version 2 of the diff

    changed this line in version 2 of the diff

  • Please register or sign in to reply
  • Review by @schmidtr

    Recommendations:

    • (optional) suggestion for more helpful error
    • it is accepted
  • added 1 commit

    • 940d0bd2 - modified: ../radio/rfsimulator/simulator.c

    Compare with previous version

  • Robert Schmidt marked this merge request as draft

    marked this merge request as draft

  • Robert Schmidt added 1 commit

    added 1 commit

    • ec25c623 - Fix: check RFsim bind() return code

    Compare with previous version

  • @arashsahbafard @lthomas I squashed the commits into one, improved the commit message, and preserved the authorship of Arash. Nothing to be done from your side, the commits are equal, so the CI run is valid (it is ok).

  • changed milestone to %OK_TO_BE_MERGED

  • Robert Schmidt mentioned in merge request !1800 (merged)

    mentioned in merge request !1800 (merged)

  • Robert Schmidt mentioned in commit 0cacf29d

    mentioned in commit 0cacf29d

  • Please register or sign in to reply
    Loading