@@ -700,9 +700,7 @@ static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &
700700
701701 bool child_released = false ;
702702
703- if ( agent.active () ) {
704- agent.attach_oob ( network.oob () );
705- }
703+ agent.attach_oob (network.oob ());
706704
707705 while ( true ) {
708706 try {
@@ -742,9 +740,7 @@ static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &
742740 sel.add_fd ( host_fd );
743741 }
744742
745- if ( agent.active () ) {
746- agent.pre_poll ();
747- }
743+ network.oob ()->pre_poll ();
748744
749745 int active_fds = sel.select ( timeout );
750746 if ( active_fds < 0 ) {
@@ -871,7 +867,7 @@ static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &
871867 /* If the pty slave is closed, reading from the master can fail with
872868 EIO (see #264). So we treat errors on read() like EOF. */
873869 if ( bytes_read <= 0 ) {
874- agent. shutdown_server ();
870+ network. oob ()-> shutdown ();
875871 network.start_shutdown ();
876872 } else {
877873 terminal_to_host += terminal.act ( string ( buf, bytes_read ) );
@@ -903,7 +899,7 @@ static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &
903899 if ( sel.any_signal () || idle_shutdown ) {
904900 /* shutdown signal */
905901 if ( network.has_remote_addr () && (!network.shutdown_in_progress ()) ) {
906- agent. shutdown_server ();
902+ network. oob ()-> shutdown ();
907903 network.start_shutdown ();
908904 } else {
909905 break ;
@@ -948,29 +944,25 @@ static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &
948944 && time_since_remote_state >= timeout_if_no_client ) {
949945 fprintf ( stderr, " No connection within %llu seconds.\n " ,
950946 static_cast <unsigned long long >( timeout_if_no_client / 1000 ) );
951- agent. shutdown_server ();
947+ network. oob ()-> shutdown ();
952948 break ;
953949 }
954950
955- if ( agent.active () ) {
956- if ( time_since_remote_state > (AGENT_IDLE_TIMEOUT * 1000 ) || time_since_remote_state > 30000 ) {
957- agent.close_sessions ();
958- }
959- agent.post_poll ();
951+ if ( time_since_remote_state > (AGENT_IDLE_TIMEOUT * 1000 ) || time_since_remote_state > 30000 ) {
952+ network.oob ()->close_sessions ();
960953 }
954+ network.oob ()->post_poll ();
961955
962956 network.tick ();
963957
964- if ( agent.active () ) {
965- agent.post_tick ();
966- }
958+ network.oob ()->post_tick ();
967959
968960 } catch ( const Network::NetworkException &e ) {
969961 fprintf ( stderr, " %s\n " , e.what () );
970962 spin ();
971963 } catch ( const Crypto::CryptoException &e ) {
972964 if ( e.fatal ) {
973- agent. shutdown_server ();
965+ network. oob ()-> shutdown ();
974966 throw ;
975967 } else {
976968 fprintf ( stderr, " Crypto exception: %s\n " , e.what () );
0 commit comments