MCPcopy Create free account
hub / github.com/Haivision/srt / worker_ProcessAddressedPacket

Method worker_ProcessAddressedPacket

srtcore/queue.cpp:1488–1536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1486}
1487
1488srt::EConnectStatus srt::CRcvQueue::worker_ProcessAddressedPacket(int32_t id, CUnit* unit, const sockaddr_any& addr)
1489{
1490 CUDT* u = m_pHash->lookup(id);
1491 if (!u)
1492 {
1493 // Pass this to either async rendezvous connection,
1494 // or store the packet in the queue.
1495 HLOGC(cnlog.Debug, log << "worker_ProcessAddressedPacket: resending to QUEUED socket @" << id);
1496 return worker_TryAsyncRend_OrStore(id, unit, addr);
1497 }
1498 // Although we don´t have an exclusive passing here,
1499 // we can count on that when the socket was once present in the hash,
1500 // it will not be deleted for at least one GC cycle. But we still need
1501 // to maintain the object existence until it's in use.
1502 // Note that here we are out of any locks, so m_GlobControlLock can be locked.
1503 CUDTUnited::SocketKeeper sk (CUDT::uglobal(), u->m_parent);
1504
1505 // Found associated CUDT - process this as control or data packet
1506 // addressed to an associated socket.
1507 if (addr != u->m_PeerAddr)
1508 {
1509 HLOGC(cnlog.Debug,
1510 log << CONID() << "Packet for SID=" << id << " asoc with " << u->m_PeerAddr.str() << " received from "
1511 << addr.str() << " (CONSIDERED ATTACK ATTEMPT)");
1512 // This came not from the address that is the peer associated
1513 // with the socket. Ignore it.
1514 return CONN_AGAIN;
1515 }
1516
1517 if (!u->m_bConnected || u->m_bBroken || u->m_bClosing)
1518 {
1519 u->m_RejectReason = SRT_REJ_CLOSE;
1520 // The socket is currently in the process of being disconnected
1521 // or destroyed. Ignore.
1522 // XXX send UMSG_SHUTDOWN in this case?
1523 // XXX May it require mutex protection?
1524 return CONN_REJECT;
1525 }
1526
1527 if (unit->m_Packet.isControl())
1528 u->processCtrl(unit->m_Packet);
1529 else
1530 u->processData(unit);
1531
1532 u->checkTimers();
1533 m_pRcvUList->update(u);
1534
1535 return CONN_RUNNING;
1536}
1537
1538// This function responds to the fact that a packet has come
1539// for a socket that does not expect to receive a normal connection

Callers 1

workerMethod · 0.95

Calls 7

isControlMethod · 0.80
processCtrlMethod · 0.80
processDataMethod · 0.80
checkTimersMethod · 0.80
lookupMethod · 0.45
strMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected