bareos: master 4a327e62

Author Committer Branch Timestamp Parent
Sebastian Sura Bareos Bot master 2024-01-04 15:11 master 49ae6652 Pending
Changeset bnet-server-tcp: split up creating+binding and listening

Instead of bnetservertcp doing open() + bind() + listen() all on its
own, we instead split it up so that you can give the tcp server some
already prepared sockets.

This can be used for great effect in unit tests, where you can now
1) create the sockets inside the test with port set to 0
2) give those sockets to the tcp server to listen to
3) query the selected (free) port with getsockname
This way you do not have to hardcode any ports inside the unit tests.

This also another step in disentangling the socket code and the bareos
core since you now do not need to read the address/port from the
configuration. Hopefully we can in the future unit tests sockets
without needing full blown config parsers.
mod - core/src/dird/socket_server.cc Diff File
mod - core/src/dird/socket_server.h Diff File
mod - core/src/filed/socket_server.cc Diff File
mod - core/src/lib/bnet_server_tcp.cc Diff File
mod - core/src/lib/bnet_server_tcp.h Diff File
mod - core/src/stored/socket_server.cc Diff File