Skip to content

Commit

Permalink
Downloads.AllowUnlimitedFirstAttempt
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan386 committed Sep 30, 2018
1 parent 8e50823 commit ba27269
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions shareaza/DownloadWithTransfers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ DWORD CDownloadWithTransfers::GetTransferCount() const

for ( CDownloadTransfer* pTransfer = m_pTransferFirst; pTransfer; pTransfer = pTransfer->m_pDlNext )
{
if ( ( pTransfer->m_nState > dtsNull ) &&
if ( ( pTransfer->m_nState >= dtsConnecting ) &&
( pTransfer->m_nProtocol != PROTOCOL_ED2K || pTransfer->m_nState != dtsQueued ) )
{
++nCount;
Expand All @@ -93,7 +93,7 @@ DWORD CDownloadWithTransfers::GetTransferCount() const
bool CDownloadWithTransfers::ValidTransfer(const IN_ADDR* pAddress, const CDownloadTransfer* pTransfer) const
{
return ( ! pAddress || pAddress->S_un.S_addr == pTransfer->m_pHost.sin_addr.S_un.S_addr ) &&
( pTransfer->m_nState > dtsNull ) &&
( pTransfer->m_nState >= dtsConnecting ) &&
( pTransfer->m_nProtocol != PROTOCOL_ED2K || pTransfer->m_nState != dtsQueued );
}

Expand Down Expand Up @@ -270,7 +270,7 @@ BOOL CDownloadWithTransfers::StartNewTransfer(DWORD tNow)
( pSource->m_nProtocol == PROTOCOL_BT ) && // Is a BT source
( pSource->m_tAttempt == 0 ) ) // Is a "fresh" source from the tracker
{
if ( pSource->CanInitiate( bConnected, FALSE ) )
if ( pSource->CanInitiate( bConnected, FALSE, Settings.Downloads.AllowUnlimitedFirstAttempt ) )
{
CDownloadTransfer* pTransfer = pSource->CreateTransfer();
return pTransfer != NULL && pTransfer->Initiate();
Expand All @@ -297,7 +297,7 @@ BOOL CDownloadWithTransfers::StartNewTransfer(DWORD tNow)
{
if ( pSource->m_tAttempt == 0 )
{
if ( pSource->CanInitiate( bConnected, FALSE ) )
if ( pSource->CanInitiate( bConnected, FALSE, Settings.Downloads.AllowUnlimitedFirstAttempt ) )
{
pConnectHead = pSource;
break;
Expand All @@ -315,7 +315,7 @@ BOOL CDownloadWithTransfers::StartNewTransfer(DWORD tNow)
{
if ( pSource->m_tAttempt == 0 )
{
if ( pSource->CanInitiate( bConnected, FALSE ) )
if ( pSource->CanInitiate( bConnected, FALSE, Settings.Downloads.AllowUnlimitedFirstAttempt ) )
{
pConnectHead = pSource;
break;
Expand All @@ -333,7 +333,10 @@ BOOL CDownloadWithTransfers::StartNewTransfer(DWORD tNow)
if ( pConnectHead->m_bPushOnly &&
pConnectHead->m_nProtocol != PROTOCOL_ED2K )
{
if ( pConnectHead->PushRequest() )
if ( ( pConnectHead->IsIPv6Source() ?
! Network.IsFirewalled( CHECK_TCP6 ):
! Network.IsFirewalled( CHECK_TCP ) )
&& pConnectHead->PushRequest() )
{
return TRUE;
}
Expand Down

0 comments on commit ba27269

Please sign in to comment.