A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Haivision/srt/commit/36f89952037c3715ed7cbfe7d98d89995ed591cf below:

added doxygen comments. · Haivision/srt@36f8995 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+44

-23

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+44

-23

lines changed Original file line number Diff line number Diff line change

@@ -815,7 +815,7 @@ void CHash::remove(int32_t id)

815 815

//

816 816

CRendezvousQueue::CRendezvousQueue()

817 817

: m_lRendezvousID()

818 -

, m_RIDVectorLock()

818 +

, m_RIDListLock()

819 819

{

820 820

}

821 821

@@ -827,7 +827,7 @@ CRendezvousQueue::~CRendezvousQueue()

827 827

void CRendezvousQueue::insert(

828 828

const SRTSOCKET& id, CUDT* u, const sockaddr_any& addr, const steady_clock::time_point& ttl)

829 829

{

830 -

ScopedLock vg(m_RIDVectorLock);

830 +

ScopedLock vg(m_RIDListLock);

831 831 832 832

CRL r;

833 833

r.m_iID = id;

@@ -843,7 +843,7 @@ void CRendezvousQueue::insert(

843 843 844 844

void CRendezvousQueue::remove(const SRTSOCKET &id)

845 845

{

846 -

ScopedLock lkv (m_RIDVectorLock);

846 +

ScopedLock lkv (m_RIDListLock);

847 847 848 848

for (list<CRL>::iterator i = m_lRendezvousID.begin(); i != m_lRendezvousID.end(); ++i)

849 849

{

@@ -855,12 +855,12 @@ void CRendezvousQueue::remove(const SRTSOCKET &id)

855 855

}

856 856

}

857 857 858 -

CUDT* CRendezvousQueue::retrieve(const sockaddr_any& addr, SRTSOCKET& w_id)

858 +

CUDT* CRendezvousQueue::retrieve(const sockaddr_any& addr, SRTSOCKET& w_id) const

859 859

{

860 -

ScopedLock vg(m_RIDVectorLock);

860 +

ScopedLock vg(m_RIDListLock);

861 861 862 862

// TODO: optimize search

863 -

for (list<CRL>::iterator i = m_lRendezvousID.begin(); i != m_lRendezvousID.end(); ++i)

863 +

for (list<CRL>::const_iterator i = m_lRendezvousID.begin(); i != m_lRendezvousID.end(); ++i)

864 864

{

865 865

if (i->m_PeerAddr == addr && ((w_id == 0) || (w_id == i->m_iID)))

866 866

{

@@ -915,7 +915,7 @@ void CRendezvousQueue::updateConnStatus(EReadStatus rst, EConnectStatus cst, con

915 915

#endif

916 916 917 917

{

918 -

ScopedLock vg(m_RIDVectorLock);

918 +

ScopedLock vg(m_RIDListLock);

919 919 920 920

if (m_lRendezvousID.empty())

921 921

return;

@@ -1004,7 +1004,7 @@ void CRendezvousQueue::updateConnStatus(EReadStatus rst, EConnectStatus cst, con

1004 1004

}

1005 1005 1006 1006

// The call to completeBrokenConnectionDependencies() cannot happen here

1007 -

// under the lock of m_RIDVectorLock as it risks a deadlock. Collect it

1007 +

// under the lock of m_RIDListLock as it risks a deadlock. Collect it

1008 1008

// to update later.

1009 1009

LinkStatusInfo fi = {i->m_pUDT, i->m_iID, ccerror, i->m_PeerAddr, -1};

1010 1010

ufailed.push_back(fi);

@@ -1026,7 +1026,7 @@ void CRendezvousQueue::updateConnStatus(EReadStatus rst, EConnectStatus cst, con

1026 1026

{

1027 1027

IF_HEAVY_LOGGING(++debug_nupd);

1028 1028 1029 -

// Collect them so that they can be updated out of m_RIDVectorLock.

1029 +

// Collect them so that they can be updated out of m_RIDListLock.

1030 1030

LinkStatusInfo fi = { i->m_pUDT, i->m_iID, SRT_SUCCESS, i->m_PeerAddr, -1};

1031 1031

uprocess.push_back(fi);

1032 1032

// NOTE: safe loop, the incrementation was done before the loop body,

@@ -1117,7 +1117,7 @@ void CRendezvousQueue::updateConnStatus(EReadStatus rst, EConnectStatus cst, con

1117 1117

{

1118 1118

// Now, additionally for every failed link reset the TTL so that

1119 1119

// they are set expired right now.

1120 -

ScopedLock vg(m_RIDVectorLock);

1120 +

ScopedLock vg(m_RIDListLock);

1121 1121

for (list<CRL>::iterator i = m_lRendezvousID.begin(); i != m_lRendezvousID.end(); ++i)

1122 1122

{

1123 1123

if (find_if(ufailed.begin(), ufailed.end(), LinkStatusInfo::HasID(i->m_iID)) != ufailed.end())

Original file line number Diff line number Diff line change

@@ -320,32 +320,53 @@ class CHash

320 320

CHash& operator=(const CHash&);

321 321

};

322 322 323 +

/// @brief A queue of sockets pending for connection.

324 +

/// It can be either a caller socket in a non-blocking mode

325 +

/// (the connection has to be handled in background),

326 +

/// or a socket in rendezvous connection mode.

323 327

class CRendezvousQueue

324 328

{

325 329

public:

326 -

CRendezvousQueue();

327 -

~CRendezvousQueue();

330 +

CRendezvousQueue();

331 +

~CRendezvousQueue();

328 332 329 333

public:

330 -

void insert(const SRTSOCKET& id, CUDT* u, const sockaddr_any& addr,

331 -

const srt::sync::steady_clock::time_point &ttl);

332 - 333 -

void remove(const SRTSOCKET& id);

334 -

CUDT* retrieve(const sockaddr_any& addr, SRTSOCKET& id);

335 - 336 -

void updateConnStatus(EReadStatus rst, EConnectStatus, const CPacket& response);

334 +

/// @brief Insert a new socket pending for connection (non-blocking caller or rendezvous).

335 +

/// @param id socket ID.

336 +

/// @param u pointer to a corresponding CUDT instance.

337 +

/// @param addr remote address to connect to.

338 +

/// @param ttl timepoint for connection attempt to expire.

339 +

void insert(const SRTSOCKET& id, CUDT* u, const sockaddr_any& addr,

340 +

const srt::sync::steady_clock::time_point &ttl);

341 + 342 +

/// @brief Remove a socket from the connection pending list.

343 +

/// @param id socket ID.

344 +

void remove(const SRTSOCKET& id);

345 + 346 +

/// @brief Locate a socket in the connection pending queue.

347 +

/// @param addr source address of the packet received over UDP (peer address).

348 +

/// @param id socket ID.

349 +

/// @return a pointer to CUDT instance retrieved, or NULL if nothing was found.

350 +

CUDT* retrieve(const sockaddr_any& addr, SRTSOCKET& id) const;

351 + 352 +

/// @brief Update status of connections in the pending queue.

353 +

/// Stop connecting if TTL expires. Resend handshake request every 250 ms if no response from the peer.

354 +

/// @param rst result of reading from a UDP socket: received packet / nothin read / read error.

355 +

/// @param cst target status for pending connection: reject or proceed.

356 +

/// @param response packet received from the UDP socket.

357 +

void updateConnStatus(EReadStatus rst, EConnectStatus cst, const CPacket& response);

337 358 338 359

private:

339 360

struct CRL

340 361

{

341 -

SRTSOCKET m_iID; // UDT socket ID (self)

342 -

CUDT* m_pUDT; // UDT instance

343 -

sockaddr_any m_PeerAddr;// UDT sonnection peer address

362 +

SRTSOCKET m_iID; // SRT socket ID (self)

363 +

CUDT* m_pUDT; // CUDT instance

364 +

sockaddr_any m_PeerAddr;// SRT sonnection peer address

344 365

srt::sync::steady_clock::time_point m_tsTTL; // the time that this request expires

345 366

};

346 367

std::list<CRL> m_lRendezvousID; // The sockets currently in rendezvous mode

347 368 348 -

srt::sync::Mutex m_RIDVectorLock;

369 +

mutable srt::sync::Mutex m_RIDListLock;

349 370

};

350 371 351 372

class CSndQueue

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4