mirror of
https://github.com/ipxe/ipxe
synced 2025-12-15 09:04:37 +03:00
[peerdist] Start block download timers from within opener methods
Move the responsibility for starting the block download timers from peerblk_expired() to peerblk_raw_open() and peerblk_retrieval_open(), in preparation for adding the ability to defer calls to peerblk_raw_open() via a block download queue. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -358,6 +358,10 @@ static int peerblk_raw_open ( struct peerdist_block *peerblk ) {
|
|||||||
if ( inject_fault ( PEERBLK_ANNUL_RATE ) )
|
if ( inject_fault ( PEERBLK_ANNUL_RATE ) )
|
||||||
intf_restart ( &peerblk->raw, 0 );
|
intf_restart ( &peerblk->raw, 0 );
|
||||||
|
|
||||||
|
/* Start download attempt timer */
|
||||||
|
peerblk->rc = -ETIMEDOUT;
|
||||||
|
start_timer_fixed ( &peerblk->timer, PEERBLK_RAW_OPEN_TIMEOUT );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,6 +526,10 @@ static int peerblk_retrieval_open ( struct peerdist_block *peerblk,
|
|||||||
if ( inject_fault ( PEERBLK_ANNUL_RATE ) )
|
if ( inject_fault ( PEERBLK_ANNUL_RATE ) )
|
||||||
intf_restart ( &peerblk->retrieval, 0 );
|
intf_restart ( &peerblk->retrieval, 0 );
|
||||||
|
|
||||||
|
/* Start download attempt timer */
|
||||||
|
peerblk->rc = -ETIMEDOUT;
|
||||||
|
start_timer_fixed ( &peerblk->timer, PEERBLK_RETRIEVAL_OPEN_TIMEOUT );
|
||||||
|
|
||||||
err_open:
|
err_open:
|
||||||
uri_put ( uri );
|
uri_put ( uri );
|
||||||
err_uri:
|
err_uri:
|
||||||
@@ -1201,10 +1209,7 @@ static void peerblk_expired ( struct retry_timer *timer, int over __unused ) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start download attempt timer */
|
/* Peer download started */
|
||||||
peerblk->rc = -ETIMEDOUT;
|
|
||||||
start_timer_fixed ( &peerblk->timer,
|
|
||||||
PEERBLK_RETRIEVAL_OPEN_TIMEOUT );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1212,9 +1217,6 @@ static void peerblk_expired ( struct retry_timer *timer, int over __unused ) {
|
|||||||
if ( ( rc = peerblk_raw_open ( peerblk ) ) != 0 )
|
if ( ( rc = peerblk_raw_open ( peerblk ) ) != 0 )
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
/* Start download attempt timer */
|
|
||||||
peerblk->rc = -ETIMEDOUT;
|
|
||||||
start_timer_fixed ( &peerblk->timer, PEERBLK_RAW_OPEN_TIMEOUT );
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
|
|||||||
Reference in New Issue
Block a user