flexnbd-proxy: ensure upstream cooldown is applied when read init from upstream fails
This commit is contained in:
10
src/proxy.c
10
src/proxy.c
@@ -634,7 +634,7 @@ int proxy_write_to_downstream( struct proxier* proxy, int state )
|
|||||||
*/
|
*/
|
||||||
void proxy_session( struct proxier* proxy )
|
void proxy_session( struct proxier* proxy )
|
||||||
{
|
{
|
||||||
uint64_t state_started;
|
uint64_t state_started = monotonic_time_ms();
|
||||||
int old_state = EXIT;
|
int old_state = EXIT;
|
||||||
int state;
|
int state;
|
||||||
int connect_to_upstream_cooldown = 0;
|
int connect_to_upstream_cooldown = 0;
|
||||||
@@ -752,13 +752,19 @@ void proxy_session( struct proxier* proxy )
|
|||||||
}
|
}
|
||||||
/* Leaving state untouched will retry connecting to upstream -
|
/* Leaving state untouched will retry connecting to upstream -
|
||||||
* so introduce a bit of sleep */
|
* so introduce a bit of sleep */
|
||||||
if ( state == CONNECT_TO_UPSTREAM ) {
|
if ( state == CONNECT_TO_UPSTREAM ) {
|
||||||
connect_to_upstream_cooldown = 1;
|
connect_to_upstream_cooldown = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case READ_INIT_FROM_UPSTREAM:
|
case READ_INIT_FROM_UPSTREAM:
|
||||||
state = proxy_read_init_from_upstream( proxy, state );
|
state = proxy_read_init_from_upstream( proxy, state );
|
||||||
|
|
||||||
|
if ( state == CONNECT_TO_UPSTREAM ) {
|
||||||
|
connect_to_upstream_cooldown = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
case WRITE_TO_UPSTREAM:
|
case WRITE_TO_UPSTREAM:
|
||||||
if ( FD_ISSET( proxy->upstream_fd, &wfds ) ) {
|
if ( FD_ISSET( proxy->upstream_fd, &wfds ) ) {
|
||||||
state = proxy_write_to_upstream( proxy, state );
|
state = proxy_write_to_upstream( proxy, state );
|
||||||
|
Reference in New Issue
Block a user