Sha256: faa3c14c78421c4505f9a874a341a45130f95388afbf7bc865e332bb98196e28
Contents?: true
Size: 1.25 KB
Versions: 21
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true module GrpcKit module Session class StreamStatus OPEN = 0 CLOSE = 1 HALF_CLOSE_REMOTE = 2 HALF_CLOSE_LOCAL = 3 def initialize @status = OPEN end # @return [void] def close_local if @status == OPEN @status = HALF_CLOSE_LOCAL elsif @status == HALF_CLOSE_REMOTE @status = CLOSE elsif @status == HALF_CLOSE_LOCAL # nothing else raise 'stream is already closed' end end # @return [void] def close_remote if @status == OPEN @status = HALF_CLOSE_REMOTE elsif @status == HALF_CLOSE_LOCAL @status = CLOSE elsif @status == HALF_CLOSE_REMOTE # nothing else raise 'stream is already closed' end end # @return [void] def close @status = CLOSE end # @return [Boolean] def close_local? (@status == HALF_CLOSE_LOCAL) || close? end # @return [Boolean] def close_remote? (@status == HALF_CLOSE_REMOTE) || close? end # @return [Boolean] def close? @status == CLOSE end end end end
Version data entries
21 entries across 21 versions & 1 rubygems