]> git.itanic.dy.fi Git - BME280_driver/commit
bmed: Avoid failing to bind() due to "Address already in use"
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Wed, 10 Mar 2021 19:19:33 +0000 (21:19 +0200)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Thu, 11 Mar 2021 17:41:16 +0000 (19:41 +0200)
commitbee2413bba67bdd144d7844d2dd8b34d444e8ac0
tree7d8522c268c26530e2e39f06d5b77be40287e1d0
parentaeefd48ce5facaa25c0debd94ec3a3ba18149087
bmed: Avoid failing to bind() due to "Address already in use"

If the previous invocation of the process happened just a while ago
(eg. the daemon was restarted), the listening socket might still be in
TIME_WAIT state, which prevents registering a new listening socket to
the port. This can be avoided by using the SO_REUSEADDR option which
instructs bind() call to bind to the port anyway.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
bmed.c