src/ruby/lib/grpc/generic/bidi_call.rb
# Provides an enumerator that yields results of remote reads
Provides an enumerator that yields results of remote reads
Provides an enumerator that yields results of remote reads
def read_loop(is_client: true)
      return enum_for(:read_loop,
                      is_client: is_client) unless block_given?
      GRPC.logger.debug('bidi-read-loop: starting')
      begin
        count = 0
        loop do
          GRPC.logger.debug("bidi-read-loop: #{count}")
          count += 1
          batch_result = read_using_run_batch
          if batch_result.message.nil?
            GRPC.logger.debug("bidi-read-loop: null batch #{batch_result}")
            if is_client
              batch_result = @call.run_batch(RECV_STATUS_ON_CLIENT => nil)
              @call.status = batch_result.status
              batch_result.check_status
              GRPC.logger.debug("bidi-read-loop: done status #{@call.status}")
            end
            GRPC.logger.debug('bidi-read-loop: done reading!')
            break
          end
          res = @unmarshal.call(batch_result.message)
          yield res
        end
      rescue StandardError => e
        GRPC.logger.warn('bidi: read-loop failed')
        GRPC.logger.warn(e)
        raise e
      end
      GRPC.logger.debug('bidi-read-loop: finished')
      @reads_complete = true
      finished
    end
def read_loop ( is_client : true ) return enum_for ( :read_loop , is_client : is_client ) unless block_given? GRPC . logger . debug ( 'bidi-read-loop: starting' ) begin count = 0 loop do GRPC . logger . debug ( "bidi-read-loop: #{count}" ) count += 1 batch_result = read_using_run_batch if batch_result . message . nil? GRPC . logger . debug ( "bidi-read-loop: null batch #{batch_result}" ) if is_client batch_result = @call . run_batch ( RECV_STATUS_ON_CLIENT => nil ) @call . status = batch_result . status batch_result . check_status GRPC . logger . debug ( "bidi-read-loop: done status #{@call.status}" ) end GRPC . logger . debug ( 'bidi-read-loop: done reading!' ) break end res = @unmarshal . call ( batch_result . message ) yield res end rescue StandardError => e GRPC . logger . warn ( 'bidi: read-loop failed' ) GRPC . logger . warn ( e ) raise e end GRPC . logger . debug ( 'bidi-read-loop: finished' ) @reads_complete = true finished end
Provides an enumerator that yields results of remote reads
Provides an enumerator that yields results of remote reads
# queue the initial read before beginning the loop # handle the next message
is_client
<not_specific>