This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Pau Espin Pedrol gerrit-no-reply at lists.osmocom.orgPau Espin Pedrol has submitted this change and it was merged. Change subject: tests: SocketTests: Pick OS-assigned instead of setting one manually ...................................................................... tests: SocketTests: Pick OS-assigned instead of setting one manually This fixes failures if the port is already being taken by other apps or if this test is run several times concurrently in the same system. Change-Id: Iea213375e489a56cf8ed3e47fe814e17c288803e --- M tests/CommonLibs/SocketsTest.cpp 1 file changed, 10 insertions(+), 9 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/CommonLibs/SocketsTest.cpp b/tests/CommonLibs/SocketsTest.cpp index 235b8f3..9a7d6f0 100644 --- a/tests/CommonLibs/SocketsTest.cpp +++ b/tests/CommonLibs/SocketsTest.cpp @@ -35,14 +35,14 @@ static const int gNumToSend = 10; -void *testReaderIP(void *) +void *testReaderIP(void *param) { - UDPSocket readSocket("127.0.0.1", 5934, "localhost", 5061); - readSocket.nonblocking(); + UDPSocket *readSocket = (UDPSocket *)param; + readSocket->nonblocking(); int rc = 0; while (rc<gNumToSend) { char buf[MAX_UDP_LENGTH]; - int count = readSocket.read(buf, MAX_UDP_LENGTH); + int count = readSocket->read(buf, MAX_UDP_LENGTH); if (count>0) { CERR("read: " << buf); rc++; @@ -56,12 +56,13 @@ int main(int argc, char * argv[] ) { + UDPSocket readSocket("127.0.0.1", 0); + UDPSocket socket1("127.0.0.1", 0, "localhost", readSocket.port()); + + CERR("socket1: " << socket1.port() << ", readSocket: " << readSocket.port()); + Thread readerThreadIP; - readerThreadIP.start(testReaderIP,NULL); - - UDPSocket socket1("127.0.0.1", 5061, "127.0.0.1", 5934); - - CERR("socket1: " << socket1.port()); + readerThreadIP.start(testReaderIP, &readSocket); // give the readers time to open sleep(1); -- To view, visit https://gerrit.osmocom.org/5780 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iea213375e489a56cf8ed3e47fe814e17c288803e Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>