On Thu, Jul 05, 2012 at 05:51:05PM -0400, Rafael Schloming wrote: > According to the log output you posted, the body of the loop is never > running. Can you log the value that pn_connection_state is returning and > verify that the test is working as expected? I don't recall offhand how > exactly bitwise operators work in Ruby.
They work the same as in other languages, where: while !(Cproton::pn_connection_state(sender.conn) & Cproton::PN_REMOTE_CLOSED) should only return a true value if the bits expressed by Cproton::PN_REMOTE_CLOSED are not all set in Cproton::pn_connection_state(sender.conn). The output you requested is: mcpierce@mcpierce-laptop:ruby (Ruby-bindings) $ ruby -I ../../cmake/bindings/ruby/ post.rb test1 test2 test3 test4 test5 -m farkle Cproton::pn_unsettled returns 0 Closing the connection. Cproton::pn_connection_state(#<SWIG::TYPE_p_pn_connection_t:0x0000000066d028>)==20 So the connection state is 20 which is #define PN_LOCAL_CLOSED (4) /**< local endpoint is closed */ #define PN_REMOTE_ACTIVE (16) /**< remote endpoint is active */ /me plays in IRB And I learned something new about Ruby: !0 != true, but !!0 == true. I replaced the previous call with: while ((Cproton::pn_connection_state(sender.conn) & Cproton::PN_REMOTE_CLOSED) != Cproton::PN_REMOTE_CLOSED) (which is pretty ugly and verbose) and the transaction doesn't exhibit the previous errors. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Delivering value year after year. Red Hat ranks #1 in value among software vendors. http://www.redhat.com/promo/vendor/
pgp4WGw1vKjft.pgp
Description: PGP signature
