flexnbd-proxy: ensure upstream cooldown is applied when read init from upstream fails

This commit is contained in:
nick
2013-07-24 16:01:38 +01:00
parent 253cee5a10
commit 5c59a412af

View File

@@ -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;
@@ -759,6 +759,12 @@ void proxy_session( struct proxier* proxy )
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 );