Permalink
Browse files

revert changes to try to reconnect, prep build for st

  • Loading branch information...
1 parent 63dd8bc commit 145449f3e9d8b11a31878393b558aa6ab99112a7 @slyphon slyphon committed May 11, 2012
Showing with 16 additions and 39 deletions.
  1. +1 −1 .dotfiles/rvmrc
  2. +2 −4 ext/c_zookeeper.rb
  3. +9 −4 ext/extconf.rb
  4. +4 −10 ext/zkrb.c
  5. +0 −20 spec/c_zookeeper_spec.rb
View
@@ -1,2 +1,2 @@
rvm ruby-1.9.3@zookeeper --create
-export DEV=1
+export ZK_DEV=1
View
@@ -105,15 +105,13 @@ def associating?
state == ZOO_ASSOCIATING_STATE
end
- def close(opts={})
+ def close
return if closed?
- close_session = !!opts.fetch(:close_session, true)
-
fn_close = proc do
if !@_closed and @_data
logger.debug { "CALLING CLOSE HANDLE!!" }
- close_handle(close_session)
+ close_handle
end
end
View
@@ -1,5 +1,6 @@
require 'mkmf'
require 'rbconfig'
+require 'fileutils'
HERE = File.expand_path(File.dirname(__FILE__))
BUNDLE = Dir.glob("zkc-*.tar.gz").first
@@ -24,6 +25,7 @@
end
ZK_DEBUG = (ENV['DEBUG'] or ARGV.any? { |arg| arg == '--debug' })
+ZK_DEV = ENV['ZK_DEV']
DEBUG_CFLAGS = " -O0 -ggdb3 -DHAVE_DEBUG"
if ZK_DEBUG
@@ -68,17 +70,20 @@ def safe_sh(cmd)
safe_sh("make install 2>&1")
end
- system("rm -rf #{BUNDLE_PATH}") unless ENV['DEBUG'] or ENV['DEV']
+ system("rm -rf #{BUNDLE_PATH}") unless ZK_DEBUG or ZK_DEV
end
end
# Absolutely prevent the linker from picking up any other zookeeper_mt
Dir.chdir("#{HERE}/lib") do
- system("cp -f libzookeeper_mt.a libzookeeper_mt_gem.a")
- system("cp -f libzookeeper_mt.la libzookeeper_mt_gem.la")
+ %w[st mt].each do |stmt|
+ %w[a la].each do |ext|
+ system("cp -f libzookeeper_#{stmt}.#{ext} libzookeeper_#{stmt}_gem.#{ext}")
+ end
+ end
end
$LIBS << " -lzookeeper_mt_gem"
-$CFLAGS << ' -Wall'
+$CFLAGS << ' -Wall' if ZK_DEV
create_makefile 'zookeeper_c'
View
@@ -62,7 +62,7 @@ static void hexbufify(char *dest, const char *src, int len) {
}
}
-static int destroy_zkrb_instance(struct zkrb_instance_data* ptr, int close_session) {
+static int destroy_zkrb_instance(struct zkrb_instance_data* ptr) {
int rv = ZOK;
zkrb_debug("destroy_zkrb_instance, zk_local_ctx: %p, zh: %p, queue: %p", ptr, ptr->zh, ptr->queue);
@@ -72,11 +72,7 @@ static int destroy_zkrb_instance(struct zkrb_instance_data* ptr, int close_sessi
/* Note that after zookeeper_close() returns, ZK handle is invalid */
zkrb_debug("obj_id: %lx, calling zookeeper_close", ptr->object_id);
- if (close_session) {
- rv = zookeeper_close(ptr->zh);
- } else {
- rv = zookeeper_drop(ptr->zh);
- }
+ rv = zookeeper_close(ptr->zh);
zkrb_debug("obj_id: %lx, zookeeper_close returned %d", ptr->object_id, rv);
free((void *) ctx);
@@ -96,7 +92,7 @@ static int destroy_zkrb_instance(struct zkrb_instance_data* ptr, int close_sessi
}
static void free_zkrb_instance_data(struct zkrb_instance_data* ptr) {
- destroy_zkrb_instance(ptr, 1);
+ destroy_zkrb_instance(ptr);
}
static void print_zkrb_instance_data(struct zkrb_instance_data* ptr) {
@@ -608,10 +604,8 @@ static VALUE method_close_handle(VALUE self, VALUE yn) {
// has been called
rb_iv_set(self, "@_closed", Qtrue);
- zkrb_debug_inst(self, "calling destroy_zkrb_instance, close_handle: %d", close_handle);
-
/* Note that after zookeeper_close() returns, ZK handle is invalid */
- int rc = destroy_zkrb_instance(zk, close_handle);
+ int rc = destroy_zkrb_instance(zk);
zkrb_debug("destroy_zkrb_instance returned: %d", rc);
View
@@ -32,26 +32,6 @@ def wait_until_connected(timeout=2)
wait_until_connected.should be_true
end
- it %[should be able to re-establish a session] do
- wait_until_connected.should be_true
-
- orig_czk = @czk
-
- client_id = orig_czk.client_id.dup
- client_id.session_id.should be > 0
-
- # something is fucked with the 'equal?' matcher
- client_id.passwd.object_id.should_not == orig_czk.client_id.passwd.object_id
-
-
- orig_czk.close(:close_session => false)
- @czk = Zookeeper::CZookeeper.new(Zookeeper.default_cnx_str, @event_queue, :client_id => client_id)
-
- wait_until_connected.should be_true
-
- @czk.client_id.session_id.should == client_id.session_id
- end
-
describe :after_connected do
before do
wait_until_connected.should be_true

0 comments on commit 145449f

Please sign in to comment.