lib/asir/transport/payload_io.rb in asir-1.0.8 vs lib/asir/transport/payload_io.rb in asir-1.1.0

- old
+ new

@@ -12,19 +12,19 @@ class UnexpectedResponse < Error; end HEADER = "# asir_payload_size: " FOOTER = "\n# asir_payload_end" - def _write payload, stream + def _write payload, stream, context stream.write HEADER stream.puts payload.size stream.write payload stream.puts FOOTER stream.flush stream end - def _read stream + def _read stream, context size = /\d+$/.match(stream.readline.chomp)[0].to_i # HEADER (size) payload = stream.read(size) stream.readline # FOOTER stream.readline payload