test: stop using swim_transport.addr as in-param
SWIM unit tests contain special libraries for emulating event loop and network: swim_test_ev and swim_test_transport. They provide API similar to libev and to network part of libc, which internally is implemented entirely in user-space and allows to simulate all kinds of errors, any time durations, etc. These test libraries are going to be re-used for Raft unit tests. But for that it is necessary to detach them from all SWIM dependencies. -- One of the dependencies - swim_transport.addr, which was used in swim_transport_send() as an input parameter. swim_transport_send() simulates sendto(), and it can't be generalized while it depends on source address being passed explicitly. This patch makes swim_transport_send() deduct the source address by the file descriptor number. There is a couple of new functions for that: swim_test_sockaddr_in_to_fd and swim_test_fd_to_sockaddr_in. They were inlined earlier, but it seems the fd <-> source address translation is used often enough to extract these functions. Part of #5303
Please register or sign in to comment