summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rb/lib/thrift/client.rb12
-rw-r--r--lib/rb/spec/client_spec.rb4
2 files changed, 13 insertions, 3 deletions
diff --git a/lib/rb/lib/thrift/client.rb b/lib/rb/lib/thrift/client.rb
index 64ef05956..5c7cd987e 100644
--- a/lib/rb/lib/thrift/client.rb
+++ b/lib/rb/lib/thrift/client.rb
@@ -50,9 +50,17 @@ module Thrift
@oprot.trans.flush
end
- def receive_message(result_klass)
+ def receive_message_begin()
fname, mtype, rseqid = @iprot.read_message_begin
- handle_exception(mtype)
+ [fname, mtype, rseqid]
+ end
+
+ def reply_seqid(rseqid)
+ result = (rseqid==@seqid)?true:false
+ result
+ end
+
+ def receive_message(result_klass)
result = result_klass.new
result.read(@iprot)
@iprot.read_message_end
diff --git a/lib/rb/spec/client_spec.rb b/lib/rb/spec/client_spec.rb
index d5d4ceedb..f015d666e 100644
--- a/lib/rb/spec/client_spec.rb
+++ b/lib/rb/spec/client_spec.rb
@@ -69,6 +69,7 @@ describe 'Client' do
expect(@prot).to receive(:read_message_end)
mock_klass = double("#<MockClass:mock>")
expect(mock_klass).to receive(:read).with(@prot)
+ @client.receive_message_begin()
@client.receive_message(double("MockClass", :new => mock_klass))
end
@@ -80,7 +81,8 @@ describe 'Client' do
expect(mock_exc).to receive(:read).with(@prot)
end
end
- expect { @client.receive_message(nil) }.to raise_error(StandardError)
+ fname, mtype, sqeid = @client.receive_message_begin()
+ expect { @client.handle_exception(mtype) }.to raise_error(StandardError)
end
it "should close the transport if an error occurs while sending a message" do