Module: IProto::ConnectionAPI

Included in:
EMConnection, TCPSocket
Defined in:
lib/iproto/connection_api.rb

Constant Summary collapse

DEFAULT_RECONNECT =
0.1
HEADER_SIZE =
12
BINARY =
::Encoding::BINARY

Instance Method Summary collapse

Instance Method Details

#next_request_idObject



7
8
9
# File 'lib/iproto/connection_api.rb', line 7

def next_request_id
  @next_request_id = ((@next_request_id ||= 0) + 1) & 0x7fffffff
end

#pack_request(request_type, request_id, body) ⇒ Object



16
17
18
19
# File 'lib/iproto/connection_api.rb', line 16

def pack_request(request_type, request_id, body)
  data = ::BinUtils.append_int32_le!(nil, request_type, body.bytesize, request_id)
  ::BinUtils.append_string!(data, body)
end

#send_request(request_id, data) ⇒ Object



11
12
13
# File 'lib/iproto/connection_api.rb', line 11

def send_request(request_id, data)
  # for override
end