MCPcopy Create free account
hub / github.com/SIPp/sipp / new_sipp_call_socket

Method new_sipp_call_socket

src/socket.cpp:1341–1378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1339}
1340
1341SIPpSocket* SIPpSocket::new_sipp_call_socket(bool use_ipv6, int transport, bool *existing) {
1342 SIPpSocket *sock = nullptr;
1343 static int next_socket;
1344 if (pollnfds >= max_multi_socket) { // we must take the main socket into account
1345 /* Find an existing socket that matches transport and ipv6 parameters. */
1346 int first = next_socket;
1347 do {
1348 int test_socket = next_socket;
1349 next_socket = (next_socket + 1) % pollnfds;
1350
1351 if (sockets[test_socket]->ss_call_socket) {
1352 /* Here we need to check that the address is the default. */
1353 if (sockets[test_socket]->ss_ipv6 != use_ipv6) {
1354 continue;
1355 }
1356 if (sockets[test_socket]->ss_transport != transport) {
1357 continue;
1358 }
1359 if (sockets[test_socket]->ss_changed_dest) {
1360 continue;
1361 }
1362
1363 sock = sockets[test_socket];
1364 sock->ss_count++;
1365 *existing = true;
1366 break;
1367 }
1368 } while (next_socket != first);
1369 if (next_socket == first) {
1370 ERROR("Could not find an existing call socket to re-use!");
1371 }
1372 } else {
1373 sock = new_sipp_socket(use_ipv6, transport);
1374 sock->ss_call_socket = true;
1375 *existing = false;
1376 }
1377 return sock;
1378}
1379
1380SIPpSocket* SIPpSocket::accept() {
1381 SIPpSocket *ret;

Callers

nothing calls this directly

Calls 2

ERRORFunction · 0.85
new_sipp_socketFunction · 0.85

Tested by

no test coverage detected