private void processSETTINGSFrame ( ) throws FlowControlException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "processSETTINGSFrame entry:\n" + currentFrame . toString ( ) ) ; } // check if this is the first non-ACK settings frame received; if so, update connection init state if ( ! connection_preface_settings_rcvd && ! ( ( FrameSettings ) currentFrame ) . flagAckSet ( ) ) { connection_preface_settings_rcvd = true ; } if ( ( ( FrameSettings ) currentFrame ) . flagAckSet ( ) ) { // if this is the first ACK frame, update connection init state if ( ! connection_preface_settings_ack_rcvd ) { connection_preface_settings_ack_rcvd = true ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "received a new settings frame: updating connection settings and sending out SETTINGS ACK" ) ; } // if the INITIAL_WINDOW_SIZE has changed, need to change it for this streams, and all the other streams on this connection if ( ( ( FrameSettings ) currentFrame ) . getInitialWindowSize ( ) != - 1 ) { int newSize = ( ( FrameSettings ) currentFrame ) . getInitialWindowSize ( ) ; muxLink . changeInitialWindowSizeAllStreams ( newSize ) ; } // update the SETTINGS for this connection muxLink . getRemoteConnectionSettings ( ) . updateSettings ( ( FrameSettings ) currentFrame ) ; muxLink . getVirtualConnection ( ) . getStateMap ( ) . put ( "h2_frame_size" , muxLink . getRemoteConnectionSettings ( ) . getMaxFrameSize ( ) ) ; // immediately send out ACK (an empty SETTINGS frame with the ACK flag set) currentFrame = new FrameSettings ( 0 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , false ) ; currentFrame . setAckFlag ( ) ; try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "processSETTINGSFrame: stream: " + myID + " frame type: " + currentFrame . getFrameType ( ) . toString ( ) + " direction: " + Direction . WRITING_OUT + " H2InboundLink hc: " + muxLink . hashCode ( ) ) ; } writeFrameSync ( ) ; } catch ( FlowControlException e ) { // FlowControlException cannot occur for FrameTypes.SETTINGS, so do nothing here but debug if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "writeSync caught (logically unexpected) FlowControlException: " + e ) ; } } } // check to see if the current connection should be marked as initialized; if so, notify stream 1 to stop waiting if ( connection_preface_settings_rcvd && connection_preface_settings_ack_rcvd ) { if ( muxLink . checkInitAndOpen ( ) ) { muxLink . initLock . countDown ( ) ; } } }
Helper method to process a SETTINGS frame received from the client . Since the protocol utilizes SETTINGS frames for initialization some special logic is needed .