From 18ab8207bd14def950fd399c60d9ee54fab75d3b Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Mon, 6 Feb 2017 11:17:34 +0100 Subject: Fixed ICE-7169 and ICE-7375 - add option to specify if batch requests flushed with the communicator/connection should be compressed --- ruby/src/IceRuby/Connection.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'ruby/src/IceRuby/Connection.cpp') diff --git a/ruby/src/IceRuby/Connection.cpp b/ruby/src/IceRuby/Connection.cpp index 2c5f65a8434..9c0a4b76ed1 100644 --- a/ruby/src/IceRuby/Connection.cpp +++ b/ruby/src/IceRuby/Connection.cpp @@ -57,7 +57,7 @@ IceRuby_Connection_close(VALUE self, VALUE mode) if(callRuby(rb_obj_is_instance_of, mode, type) != Qtrue) { throw RubyException(rb_eTypeError, - "value for 'mode' argument must be an enumerator of Ice.ConnectionClose"); + "value for 'mode' argument must be an enumerator of Ice::ConnectionClose"); } volatile VALUE modeValue = callRuby(rb_funcall, mode, rb_intern("to_i"), 0); assert(TYPE(modeValue) == T_FIXNUM); @@ -70,14 +70,23 @@ IceRuby_Connection_close(VALUE self, VALUE mode) extern "C" VALUE -IceRuby_Connection_flushBatchRequests(VALUE self) +IceRuby_Connection_flushBatchRequests(VALUE self, VALUE compress) { ICE_RUBY_TRY { Ice::ConnectionPtr* p = reinterpret_cast(DATA_PTR(self)); assert(p); - (*p)->flushBatchRequests(); + volatile VALUE type = callRuby(rb_path2class, "Ice::CompressBatch"); + if(callRuby(rb_obj_is_instance_of, compress, type) != Qtrue) + { + throw RubyException(rb_eTypeError, + "value for 'compress' argument must be an enumerator of Ice::CompressBatch"); + } + volatile VALUE compressValue = callRuby(rb_funcall, compress, rb_intern("to_i"), 0); + assert(TYPE(compressValue) == T_FIXNUM); + Ice::CompressBatch cb = static_cast(FIX2LONG(compressValue)); + (*p)->flushBatchRequests(cb); } ICE_RUBY_CATCH return Qnil; @@ -416,7 +425,7 @@ IceRuby::initConnection(VALUE iceModule) // Instance methods. // rb_define_method(_connectionClass, "close", CAST_METHOD(IceRuby_Connection_close), 1); - rb_define_method(_connectionClass, "flushBatchRequests", CAST_METHOD(IceRuby_Connection_flushBatchRequests), 0); + rb_define_method(_connectionClass, "flushBatchRequests", CAST_METHOD(IceRuby_Connection_flushBatchRequests), 1); rb_define_method(_connectionClass, "heartbeat", CAST_METHOD(IceRuby_Connection_heartbeat), 0); rb_define_method(_connectionClass, "setACM", CAST_METHOD(IceRuby_Connection_setACM), 3); rb_define_method(_connectionClass, "getACM", CAST_METHOD(IceRuby_Connection_getACM), 0); -- cgit v1.2.3