summaryrefslogtreecommitdiff
path: root/ruby/src/IceRuby/Communicator.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-02-06 11:17:34 +0100
committerBenoit Foucher <benoit@zeroc.com>2017-02-06 11:17:34 +0100
commit18ab8207bd14def950fd399c60d9ee54fab75d3b (patch)
treea82af333127184acc6be6e0969919cb20be5e8b3 /ruby/src/IceRuby/Communicator.cpp
parentFixed ICE-7548 - getAdminProxy no longer returns 0 if synchronization is in p... (diff)
downloadice-18ab8207bd14def950fd399c60d9ee54fab75d3b.tar.bz2
ice-18ab8207bd14def950fd399c60d9ee54fab75d3b.tar.xz
ice-18ab8207bd14def950fd399c60d9ee54fab75d3b.zip
Fixed ICE-7169 and ICE-7375 - add option to specify if batch requests flushed with the communicator/connection should be compressed
Diffstat (limited to 'ruby/src/IceRuby/Communicator.cpp')
-rw-r--r--ruby/src/IceRuby/Communicator.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/ruby/src/IceRuby/Communicator.cpp b/ruby/src/IceRuby/Communicator.cpp
index 232092dd9bd..cb7c24fd9a5 100644
--- a/ruby/src/IceRuby/Communicator.cpp
+++ b/ruby/src/IceRuby/Communicator.cpp
@@ -613,12 +613,22 @@ IceRuby_Communicator_setDefaultLocator(VALUE self, VALUE locator)
extern "C"
VALUE
-IceRuby_Communicator_flushBatchRequests(VALUE self)
+IceRuby_Communicator_flushBatchRequests(VALUE self, VALUE compress)
{
ICE_RUBY_TRY
{
Ice::CommunicatorPtr p = getCommunicator(self);
- 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<Ice::CompressBatch>(FIX2LONG(compressValue));
+ p->flushBatchRequests(cb);
}
ICE_RUBY_CATCH
return Qnil;
@@ -651,7 +661,7 @@ IceRuby::initCommunicator(VALUE iceModule)
rb_define_method(_communicatorClass, "setDefaultRouter", CAST_METHOD(IceRuby_Communicator_setDefaultRouter), 1);
rb_define_method(_communicatorClass, "getDefaultLocator", CAST_METHOD(IceRuby_Communicator_getDefaultLocator), 0);
rb_define_method(_communicatorClass, "setDefaultLocator", CAST_METHOD(IceRuby_Communicator_setDefaultLocator), 1);
- rb_define_method(_communicatorClass, "flushBatchRequests", CAST_METHOD(IceRuby_Communicator_flushBatchRequests), 0);
+ rb_define_method(_communicatorClass, "flushBatchRequests", CAST_METHOD(IceRuby_Communicator_flushBatchRequests), 1);
}
Ice::CommunicatorPtr