zookeeper-ng 1.5.2.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.ctags_paths +1 -0
- data/.dotfiles/ruby-gemset +1 -0
- data/.dotfiles/ruby-version +1 -0
- data/.dotfiles/rvmrc +2 -0
- data/.github/workflows/build.yml +57 -0
- data/.gitignore +19 -0
- data/.gitmodules +3 -0
- data/CHANGELOG +408 -0
- data/Gemfile +30 -0
- data/Guardfile +8 -0
- data/LICENSE +23 -0
- data/Manifest +29 -0
- data/README.markdown +62 -0
- data/Rakefile +121 -0
- data/cause-abort.rb +117 -0
- data/ext/.gitignore +6 -0
- data/ext/Rakefile +41 -0
- data/ext/c_zookeeper.rb +398 -0
- data/ext/common.h +17 -0
- data/ext/dbg.h +53 -0
- data/ext/depend +5 -0
- data/ext/event_lib.c +740 -0
- data/ext/event_lib.h +175 -0
- data/ext/extconf.rb +103 -0
- data/ext/generate_gvl_code.rb +321 -0
- data/ext/patches/zkc-3.3.5-network.patch +24 -0
- data/ext/patches/zkc-3.4.5-buffer-overflow.patch +11 -0
- data/ext/patches/zkc-3.4.5-config.patch +5454 -0
- data/ext/patches/zkc-3.4.5-fetch-and-add.patch +16 -0
- data/ext/patches/zkc-3.4.5-logging.patch +41 -0
- data/ext/patches/zkc-3.4.5-out-of-order-ping.patch +163 -0
- data/ext/patches/zkc-3.4.5-yosemite-htonl-fix.patch +102 -0
- data/ext/zkc-3.4.5.tar.gz +0 -0
- data/ext/zkrb.c +1080 -0
- data/ext/zkrb_wrapper.c +775 -0
- data/ext/zkrb_wrapper.h +350 -0
- data/ext/zkrb_wrapper_compat.c +15 -0
- data/ext/zkrb_wrapper_compat.h +11 -0
- data/ext/zookeeper_base.rb +256 -0
- data/java/java_base.rb +501 -0
- data/lib/zookeeper/acls.rb +44 -0
- data/lib/zookeeper/callbacks.rb +108 -0
- data/lib/zookeeper/client.rb +30 -0
- data/lib/zookeeper/client_methods.rb +282 -0
- data/lib/zookeeper/common/queue_with_pipe.rb +110 -0
- data/lib/zookeeper/common.rb +122 -0
- data/lib/zookeeper/compatibility.rb +138 -0
- data/lib/zookeeper/constants.rb +97 -0
- data/lib/zookeeper/continuation.rb +223 -0
- data/lib/zookeeper/core_ext.rb +58 -0
- data/lib/zookeeper/em_client.rb +55 -0
- data/lib/zookeeper/exceptions.rb +135 -0
- data/lib/zookeeper/forked.rb +19 -0
- data/lib/zookeeper/latch.rb +34 -0
- data/lib/zookeeper/logger/forwarding_logger.rb +84 -0
- data/lib/zookeeper/logger.rb +39 -0
- data/lib/zookeeper/monitor.rb +19 -0
- data/lib/zookeeper/rake_tasks.rb +165 -0
- data/lib/zookeeper/request_registry.rb +153 -0
- data/lib/zookeeper/stat.rb +21 -0
- data/lib/zookeeper/version.rb +4 -0
- data/lib/zookeeper.rb +115 -0
- data/notes.txt +14 -0
- data/scripts/upgrade-1.0-sed-alike.rb +46 -0
- data/spec/c_zookeeper_spec.rb +51 -0
- data/spec/chrooted_connection_spec.rb +83 -0
- data/spec/compatibilty_spec.rb +8 -0
- data/spec/default_watcher_spec.rb +41 -0
- data/spec/em_spec.rb +51 -0
- data/spec/ext/zookeeper_base_spec.rb +19 -0
- data/spec/forked_connection_spec.rb +122 -0
- data/spec/latch_spec.rb +24 -0
- data/spec/log4j.properties +17 -0
- data/spec/shared/all_success_return_values.rb +10 -0
- data/spec/shared/connection_examples.rb +1081 -0
- data/spec/spec_helper.rb +61 -0
- data/spec/support/00_logging.rb +38 -0
- data/spec/support/10_spawn_zookeeper.rb +20 -0
- data/spec/support/progress_formatter.rb +15 -0
- data/spec/support/zookeeper_spec_helpers.rb +96 -0
- data/spec/zookeeper_spec.rb +24 -0
- data/zookeeper.gemspec +46 -0
- data/zoomonkey/duplicates +3 -0
- data/zoomonkey/zoomonkey.rb +194 -0
- metadata +185 -0
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            diff -ur zkc-3.4.5-orig/c/src/mt_adaptor.c zkc-3.4.5/c/src/mt_adaptor.c
         | 
| 2 | 
            +
            --- zkc-3.4.5-orig/c/src/mt_adaptor.c	2012-09-30 10:53:32.000000000 -0700
         | 
| 3 | 
            +
            +++ zkc-3.4.5/c/src/mt_adaptor.c	2016-09-07 16:55:13.787553837 -0700
         | 
| 4 | 
            +
            @@ -484,11 +484,7 @@
         | 
| 5 | 
            +
             {
         | 
| 6 | 
            +
             #ifndef WIN32
         | 
| 7 | 
            +
                 int32_t result;
         | 
| 8 | 
            +
            -    asm __volatile__(
         | 
| 9 | 
            +
            -         "lock xaddl %0,%1\n"
         | 
| 10 | 
            +
            -         : "=r"(result), "=m"(*(int *)operand)
         | 
| 11 | 
            +
            -         : "0"(incr)
         | 
| 12 | 
            +
            -         : "memory");
         | 
| 13 | 
            +
            +    result = __sync_fetch_and_add(operand, incr);
         | 
| 14 | 
            +
                return result;
         | 
| 15 | 
            +
             #else
         | 
| 16 | 
            +
                 volatile int32_t result;
         | 
| @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            diff -ur zkc-3.4.5-orig/c/src/zookeeper.c zkc-3.4.5/c/src/zookeeper.c
         | 
| 2 | 
            +
            --- zkc-3.4.5-orig/c/src/zookeeper.c	2012-09-30 10:53:32.000000000 -0700
         | 
| 3 | 
            +
            +++ zkc-3.4.5/c/src/zookeeper.c	2013-09-07 21:25:24.000000000 -0700
         | 
| 4 | 
            +
            @@ -1650,14 +1650,16 @@
         | 
| 5 | 
            +
                     // a PING
         | 
| 6 | 
            +
                     if (zh->state==ZOO_CONNECTED_STATE) {
         | 
| 7 | 
            +
                         send_to = zh->recv_timeout/3 - idle_send;
         | 
| 8 | 
            +
            -            if (send_to <= 0 && zh->sent_requests.head==0) {
         | 
| 9 | 
            +
            -//                LOG_DEBUG(("Sending PING to %s (exceeded idle by %dms)",
         | 
| 10 | 
            +
            -//                                format_current_endpoint_info(zh),-send_to));
         | 
| 11 | 
            +
            -                int rc=send_ping(zh);
         | 
| 12 | 
            +
            -                if (rc < 0){
         | 
| 13 | 
            +
            -                    LOG_ERROR(("failed to send PING request (zk retcode=%d)",rc));
         | 
| 14 | 
            +
            -                    return api_epilog(zh,rc);
         | 
| 15 | 
            +
            -                }
         | 
| 16 | 
            +
            +            if (send_to <= 0) {
         | 
| 17 | 
            +
            +                if (zh->sent_requests.head==0) {
         | 
| 18 | 
            +
            +                    LOG_DEBUG(("Sending PING to %s (exceeded idle by %dms)",
         | 
| 19 | 
            +
            +                                   format_current_endpoint_info(zh),-send_to));
         | 
| 20 | 
            +
            +                    int rc=send_ping(zh);
         | 
| 21 | 
            +
            +                    if (rc < 0){
         | 
| 22 | 
            +
            +                        LOG_ERROR(("failed to send PING request (zk retcode=%d)",rc));
         | 
| 23 | 
            +
            +                        return api_epilog(zh,rc);
         | 
| 24 | 
            +
            +                    }
         | 
| 25 | 
            +
            +                }
         | 
| 26 | 
            +
                             send_to = zh->recv_timeout/3;
         | 
| 27 | 
            +
                         }
         | 
| 28 | 
            +
                     }
         | 
| 29 | 
            +
            @@ -1669,6 +1671,12 @@
         | 
| 30 | 
            +
                         zh->next_deadline.tv_sec += zh->next_deadline.tv_usec / 1000000;
         | 
| 31 | 
            +
                         zh->next_deadline.tv_usec = zh->next_deadline.tv_usec % 1000000;
         | 
| 32 | 
            +
                     }
         | 
| 33 | 
            +
            +        
         | 
| 34 | 
            +
            +        if (tv->tv_sec == 0 && tv->tv_usec == 0) {
         | 
| 35 | 
            +
            +          LOG_DEBUG(("Returning a 0.0 timeval: state=%d idle_recv=%d idle_send=%d recv_to=%d send_to=%d  send_requests=%s",
         | 
| 36 | 
            +
            +            zh->state, idle_recv, idle_send, recv_to, send_to, zh->sent_requests.head==0 ? "false" : "true"));
         | 
| 37 | 
            +
            +        }
         | 
| 38 | 
            +
            +        
         | 
| 39 | 
            +
                     *interest = ZOOKEEPER_READ;
         | 
| 40 | 
            +
                     /* we are interested in a write if we are connected and have something
         | 
| 41 | 
            +
                      * to send, or we are waiting for a connect to finish. */
         | 
| @@ -0,0 +1,163 @@ | |
| 1 | 
            +
            diff --git zkc-3.4.5-orig/c/src/zookeeper.c zkc-3.4.5/c/src/zookeeper.c
         | 
| 2 | 
            +
            index de58c62..2347ff4 100644
         | 
| 3 | 
            +
            --- zkc-3.4.5-orig/c/src/zookeeper.c
         | 
| 4 | 
            +
            +++ zkc-3.4.5/c/src/zookeeper.c
         | 
| 5 | 
            +
            @@ -1167,25 +1167,20 @@ void free_completions(zhandle_t *zh,int callCompletion,int reason)
         | 
| 6 | 
            +
                         zh->outstanding_sync--;
         | 
| 7 | 
            +
                         destroy_completion_entry(cptr);
         | 
| 8 | 
            +
                     } else if (callCompletion) {
         | 
| 9 | 
            +
            -            if(cptr->xid == PING_XID){
         | 
| 10 | 
            +
            -                // Nothing to do with a ping response
         | 
| 11 | 
            +
            -                destroy_completion_entry(cptr);
         | 
| 12 | 
            +
            -            } else {
         | 
| 13 | 
            +
            -                // Fake the response
         | 
| 14 | 
            +
            -                buffer_list_t *bptr;
         | 
| 15 | 
            +
            -                h.xid = cptr->xid;
         | 
| 16 | 
            +
            -                h.zxid = -1;
         | 
| 17 | 
            +
            -                h.err = reason;
         | 
| 18 | 
            +
            -                oa = create_buffer_oarchive();
         | 
| 19 | 
            +
            -                serialize_ReplyHeader(oa, "header", &h);
         | 
| 20 | 
            +
            -                bptr = calloc(sizeof(*bptr), 1);
         | 
| 21 | 
            +
            -                assert(bptr);
         | 
| 22 | 
            +
            -                bptr->len = get_buffer_len(oa);
         | 
| 23 | 
            +
            -                bptr->buffer = get_buffer(oa);
         | 
| 24 | 
            +
            -                close_buffer_oarchive(&oa, 0);
         | 
| 25 | 
            +
            -                cptr->buffer = bptr;
         | 
| 26 | 
            +
            -                queue_completion(&zh->completions_to_process, cptr, 0);
         | 
| 27 | 
            +
            -            }
         | 
| 28 | 
            +
            +            // Fake the response
         | 
| 29 | 
            +
            +            buffer_list_t *bptr;
         | 
| 30 | 
            +
            +            h.xid = cptr->xid;
         | 
| 31 | 
            +
            +            h.zxid = -1;
         | 
| 32 | 
            +
            +            h.err = reason;
         | 
| 33 | 
            +
            +            oa = create_buffer_oarchive();
         | 
| 34 | 
            +
            +            serialize_ReplyHeader(oa, "header", &h);
         | 
| 35 | 
            +
            +            bptr = calloc(sizeof(*bptr), 1);
         | 
| 36 | 
            +
            +            assert(bptr);
         | 
| 37 | 
            +
            +            bptr->len = get_buffer_len(oa);
         | 
| 38 | 
            +
            +            bptr->buffer = get_buffer(oa);
         | 
| 39 | 
            +
            +            close_buffer_oarchive(&oa, 0);
         | 
| 40 | 
            +
            +            cptr->buffer = bptr;
         | 
| 41 | 
            +
            +            queue_completion(&zh->completions_to_process, cptr, 0);
         | 
| 42 | 
            +
                     }
         | 
| 43 | 
            +
                 }
         | 
| 44 | 
            +
                 a_list.completion = NULL;
         | 
| 45 | 
            +
            @@ -1526,7 +1521,6 @@ static struct timeval get_timeval(int interval)
         | 
| 46 | 
            +
                 rc = serialize_RequestHeader(oa, "header", &h);
         | 
| 47 | 
            +
                 enter_critical(zh);
         | 
| 48 | 
            +
                 gettimeofday(&zh->last_ping, 0);
         | 
| 49 | 
            +
            -    rc = rc < 0 ? rc : add_void_completion(zh, h.xid, 0, 0);
         | 
| 50 | 
            +
                 rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa),
         | 
| 51 | 
            +
                         get_buffer_len(oa));
         | 
| 52 | 
            +
                 leave_critical(zh);
         | 
| 53 | 
            +
            @@ -2063,12 +2057,8 @@ static void deserialize_response(int type, int xid, int failed, int rc, completi
         | 
| 54 | 
            +
                 case COMPLETION_VOID:
         | 
| 55 | 
            +
                     LOG_DEBUG(("Calling COMPLETION_VOID for xid=%#x failed=%d rc=%d",
         | 
| 56 | 
            +
                                 cptr->xid, failed, rc));
         | 
| 57 | 
            +
            -        if (xid == PING_XID) {
         | 
| 58 | 
            +
            -            // We want to skip the ping
         | 
| 59 | 
            +
            -        } else {
         | 
| 60 | 
            +
            -            assert(cptr->c.void_result);
         | 
| 61 | 
            +
            -            cptr->c.void_result(rc, cptr->data);
         | 
| 62 | 
            +
            -        }
         | 
| 63 | 
            +
            +        assert(cptr->c.void_result);
         | 
| 64 | 
            +
            +        cptr->c.void_result(rc, cptr->data);
         | 
| 65 | 
            +
                     break;
         | 
| 66 | 
            +
                 case COMPLETION_MULTI:
         | 
| 67 | 
            +
                     LOG_DEBUG(("Calling COMPLETION_MULTI for xid=%#x failed=%d rc=%d",
         | 
| 68 | 
            +
            @@ -2184,7 +2174,15 @@ int zookeeper_process(zhandle_t *zh, int events)
         | 
| 69 | 
            +
                         // fprintf(stderr, "Got %#x for %#x\n", hdr.zxid, hdr.xid);
         | 
| 70 | 
            +
                     }
         | 
| 71 | 
            +
             
         | 
| 72 | 
            +
            -        if (hdr.xid == WATCHER_EVENT_XID) {
         | 
| 73 | 
            +
            +        if (hdr.xid == PING_XID) {
         | 
| 74 | 
            +
            +            // Ping replies can arrive out-of-order
         | 
| 75 | 
            +
            +            int elapsed = 0;
         | 
| 76 | 
            +
            +            struct timeval now;
         | 
| 77 | 
            +
            +            gettimeofday(&now, 0);
         | 
| 78 | 
            +
            +            elapsed = calculate_interval(&zh->last_ping, &now);
         | 
| 79 | 
            +
            +            LOG_DEBUG(("Got ping response in %d ms", elapsed));
         | 
| 80 | 
            +
            +            free_buffer(bptr);
         | 
| 81 | 
            +
            +        } else if (hdr.xid == WATCHER_EVENT_XID) {
         | 
| 82 | 
            +
                         struct WatcherEvent evt;
         | 
| 83 | 
            +
                         int type = 0;
         | 
| 84 | 
            +
                         char *path = NULL;
         | 
| 85 | 
            +
            @@ -2250,22 +2248,9 @@ int zookeeper_process(zhandle_t *zh, int events)
         | 
| 86 | 
            +
                         activateWatcher(zh, cptr->watcher, rc);
         | 
| 87 | 
            +
             
         | 
| 88 | 
            +
                         if (cptr->c.void_result != SYNCHRONOUS_MARKER) {
         | 
| 89 | 
            +
            -                if(hdr.xid == PING_XID){
         | 
| 90 | 
            +
            -                    int elapsed = 0;
         | 
| 91 | 
            +
            -                    struct timeval now;
         | 
| 92 | 
            +
            -                    gettimeofday(&now, 0);
         | 
| 93 | 
            +
            -                    elapsed = calculate_interval(&zh->last_ping, &now);
         | 
| 94 | 
            +
            -                    LOG_DEBUG(("Got ping response in %d ms", elapsed));
         | 
| 95 | 
            +
            -
         | 
| 96 | 
            +
            -                    // Nothing to do with a ping response
         | 
| 97 | 
            +
            -                    free_buffer(bptr);
         | 
| 98 | 
            +
            -                    destroy_completion_entry(cptr);
         | 
| 99 | 
            +
            -                } else {
         | 
| 100 | 
            +
            -                    LOG_DEBUG(("Queueing asynchronous response"));
         | 
| 101 | 
            +
            -
         | 
| 102 | 
            +
            -                    cptr->buffer = bptr;
         | 
| 103 | 
            +
            -                    queue_completion(&zh->completions_to_process, cptr, 0);
         | 
| 104 | 
            +
            -                }
         | 
| 105 | 
            +
            +                LOG_DEBUG(("Queueing asynchronous response"));
         | 
| 106 | 
            +
            +                cptr->buffer = bptr;
         | 
| 107 | 
            +
            +                queue_completion(&zh->completions_to_process, cptr, 0);
         | 
| 108 | 
            +
                         } else {
         | 
| 109 | 
            +
                             struct sync_completion
         | 
| 110 | 
            +
                                     *sc = (struct sync_completion*)cptr->data;
         | 
| 111 | 
            +
            diff --git zkc-3.4.5-orig/c/tests/TestOperations.cc zkc-3.4.5/c/tests/TestOperations.cc
         | 
| 112 | 
            +
            index b0370e9..27d9270 100644
         | 
| 113 | 
            +
            --- zkc-3.4.5-orig/c/tests/TestOperations.cc
         | 
| 114 | 
            +
            +++ zkc-3.4.5/c/tests/TestOperations.cc
         | 
| 115 | 
            +
            @@ -29,6 +29,7 @@ class Zookeeper_operations : public CPPUNIT_NS::TestFixture
         | 
| 116 | 
            +
                 CPPUNIT_TEST_SUITE(Zookeeper_operations);
         | 
| 117 | 
            +
             #ifndef THREADED
         | 
| 118 | 
            +
                 CPPUNIT_TEST(testPing);
         | 
| 119 | 
            +
            +    CPPUNIT_TEST(testUnsolicitedPing);
         | 
| 120 | 
            +
                 CPPUNIT_TEST(testTimeoutCausedByWatches1);
         | 
| 121 | 
            +
                 CPPUNIT_TEST(testTimeoutCausedByWatches2);
         | 
| 122 | 
            +
             #else    
         | 
| 123 | 
            +
            @@ -305,6 +306,40 @@ public:
         | 
| 124 | 
            +
                     CPPUNIT_ASSERT_EQUAL(1,zkServer.pingCount_);
         | 
| 125 | 
            +
                 }
         | 
| 126 | 
            +
             
         | 
| 127 | 
            +
            +    // ZOOKEEPER-2253: Permit unsolicited pings
         | 
| 128 | 
            +
            +    void testUnsolicitedPing()
         | 
| 129 | 
            +
            +    {
         | 
| 130 | 
            +
            +        const int TIMEOUT=9; // timeout in secs
         | 
| 131 | 
            +
            +        Mock_gettimeofday timeMock;
         | 
| 132 | 
            +
            +        PingCountingServer zkServer;
         | 
| 133 | 
            +
            +        // must call zookeeper_close() while all the mocks are in scope
         | 
| 134 | 
            +
            +        CloseFinally guard(&zh);
         | 
| 135 | 
            +
            +
         | 
| 136 | 
            +
            +        // receive timeout is in milliseconds
         | 
| 137 | 
            +
            +        zh=zookeeper_init("localhost:1234",watcher,TIMEOUT*1000,TEST_CLIENT_ID,0,0);
         | 
| 138 | 
            +
            +        CPPUNIT_ASSERT(zh!=0);
         | 
| 139 | 
            +
            +        // simulate connected state
         | 
| 140 | 
            +
            +        forceConnected(zh);
         | 
| 141 | 
            +
            +
         | 
| 142 | 
            +
            +        int fd=0;
         | 
| 143 | 
            +
            +        int interest=0;
         | 
| 144 | 
            +
            +        timeval tv;
         | 
| 145 | 
            +
            +
         | 
| 146 | 
            +
            +        int rc=zookeeper_interest(zh,&fd,&interest,&tv);
         | 
| 147 | 
            +
            +        CPPUNIT_ASSERT_EQUAL((int)ZOK,rc);
         | 
| 148 | 
            +
            +
         | 
| 149 | 
            +
            +        // verify no ping sent
         | 
| 150 | 
            +
            +        CPPUNIT_ASSERT(zkServer.pingCount_==0);
         | 
| 151 | 
            +
            +
         | 
| 152 | 
            +
            +        // we're going to receive a unsolicited PING response; ensure
         | 
| 153 | 
            +
            +        // that the client has updated its last_recv timestamp
         | 
| 154 | 
            +
            +        timeMock.tick(tv);
         | 
| 155 | 
            +
            +        zkServer.addRecvResponse(new PingResponse);
         | 
| 156 | 
            +
            +        rc=zookeeper_process(zh,interest);
         | 
| 157 | 
            +
            +        CPPUNIT_ASSERT_EQUAL((int)ZOK,rc);
         | 
| 158 | 
            +
            +        CPPUNIT_ASSERT(timeMock==zh->last_recv);
         | 
| 159 | 
            +
            +    }
         | 
| 160 | 
            +
            +
         | 
| 161 | 
            +
                 // simulate a watch arriving right before a ping is due
         | 
| 162 | 
            +
                 // assert the ping is sent nevertheless
         | 
| 163 | 
            +
                 void testTimeoutCausedByWatches1()
         | 
| @@ -0,0 +1,102 @@ | |
| 1 | 
            +
            diff -ur zkc-3.4.5-orig/c/include/recordio.h zkc-3.4.5/c/include/recordio.h
         | 
| 2 | 
            +
            --- zkc-3.4.5-orig/c/include/recordio.h	2012-09-30 13:53:32.000000000 -0400
         | 
| 3 | 
            +
            +++ zkc-3.4.5/c/include/recordio.h	2014-07-29 03:13:27.000000000 -0400
         | 
| 4 | 
            +
            @@ -73,7 +73,7 @@
         | 
| 5 | 
            +
             char *get_buffer(struct oarchive *);
         | 
| 6 | 
            +
             int get_buffer_len(struct oarchive *);
         | 
| 7 | 
            +
             
         | 
| 8 | 
            +
            -int64_t htonll(int64_t v);
         | 
| 9 | 
            +
            +int64_t zk_htonll(int64_t v);
         | 
| 10 | 
            +
             
         | 
| 11 | 
            +
             #ifdef __cplusplus
         | 
| 12 | 
            +
             }
         | 
| 13 | 
            +
            diff -ur zkc-3.4.5-orig/c/src/recordio.c zkc-3.4.5/c/src/recordio.c
         | 
| 14 | 
            +
            --- zkc-3.4.5-orig/c/src/recordio.c	2012-09-30 13:53:32.000000000 -0400
         | 
| 15 | 
            +
            +++ zkc-3.4.5/c/src/recordio.c	2014-07-29 03:13:35.000000000 -0400
         | 
| 16 | 
            +
            @@ -80,7 +80,7 @@
         | 
| 17 | 
            +
                 priv->off+=sizeof(i);
         | 
| 18 | 
            +
                 return 0;
         | 
| 19 | 
            +
             }
         | 
| 20 | 
            +
            -int64_t htonll(int64_t v)
         | 
| 21 | 
            +
            +int64_t zk_htonll(int64_t v)
         | 
| 22 | 
            +
             {
         | 
| 23 | 
            +
                 int i = 0;
         | 
| 24 | 
            +
                 char *s = (char *)&v;
         | 
| 25 | 
            +
            @@ -98,7 +98,7 @@
         | 
| 26 | 
            +
             
         | 
| 27 | 
            +
             int oa_serialize_long(struct oarchive *oa, const char *tag, const int64_t *d)
         | 
| 28 | 
            +
             {
         | 
| 29 | 
            +
            -    const int64_t i = htonll(*d);
         | 
| 30 | 
            +
            +    const int64_t i = zk_htonll(*d);
         | 
| 31 | 
            +
                 struct buff_struct *priv = oa->priv;
         | 
| 32 | 
            +
                 if ((priv->len - priv->off) < sizeof(i)) {
         | 
| 33 | 
            +
                     int rc = resize_buffer(priv, priv->len + sizeof(i));
         | 
| 34 | 
            +
            @@ -207,7 +207,7 @@
         | 
| 35 | 
            +
                 }
         | 
| 36 | 
            +
                 memcpy(count, priv->buffer+priv->off, sizeof(*count));
         | 
| 37 | 
            +
                 priv->off+=sizeof(*count);
         | 
| 38 | 
            +
            -    v = htonll(*count); // htonll and  ntohll do the same
         | 
| 39 | 
            +
            +    v = zk_htonll(*count); // zk_htonll and  ntohll do the same
         | 
| 40 | 
            +
                 *count = v;
         | 
| 41 | 
            +
                 return 0;
         | 
| 42 | 
            +
             }
         | 
| 43 | 
            +
            diff -ur zkc-3.4.5-orig/c/src/zookeeper.c zkc-3.4.5/c/src/zookeeper.c
         | 
| 44 | 
            +
            --- zkc-3.4.5-orig/c/src/zookeeper.c	2012-09-30 13:53:32.000000000 -0400
         | 
| 45 | 
            +
            +++ zkc-3.4.5/c/src/zookeeper.c	2014-07-29 03:13:45.000000000 -0400
         | 
| 46 | 
            +
            @@ -1408,7 +1408,7 @@
         | 
| 47 | 
            +
                 memcpy(buffer + offset, &req->protocolVersion, sizeof(req->protocolVersion));
         | 
| 48 | 
            +
                 offset = offset +  sizeof(req->protocolVersion);
         | 
| 49 | 
            +
             
         | 
| 50 | 
            +
            -    req->lastZxidSeen = htonll(req->lastZxidSeen);
         | 
| 51 | 
            +
            +    req->lastZxidSeen = zk_htonll(req->lastZxidSeen);
         | 
| 52 | 
            +
                 memcpy(buffer + offset, &req->lastZxidSeen, sizeof(req->lastZxidSeen));
         | 
| 53 | 
            +
                 offset = offset +  sizeof(req->lastZxidSeen);
         | 
| 54 | 
            +
             
         | 
| 55 | 
            +
            @@ -1416,7 +1416,7 @@
         | 
| 56 | 
            +
                 memcpy(buffer + offset, &req->timeOut, sizeof(req->timeOut));
         | 
| 57 | 
            +
                 offset = offset +  sizeof(req->timeOut);
         | 
| 58 | 
            +
             
         | 
| 59 | 
            +
            -    req->sessionId = htonll(req->sessionId);
         | 
| 60 | 
            +
            +    req->sessionId = zk_htonll(req->sessionId);
         | 
| 61 | 
            +
                 memcpy(buffer + offset, &req->sessionId, sizeof(req->sessionId));
         | 
| 62 | 
            +
                 offset = offset +  sizeof(req->sessionId);
         | 
| 63 | 
            +
             
         | 
| 64 | 
            +
            @@ -1447,7 +1447,7 @@
         | 
| 65 | 
            +
                  memcpy(&req->sessionId, buffer + offset, sizeof(req->sessionId));
         | 
| 66 | 
            +
                  offset = offset +  sizeof(req->sessionId);
         | 
| 67 | 
            +
             
         | 
| 68 | 
            +
            -     req->sessionId = htonll(req->sessionId);
         | 
| 69 | 
            +
            +     req->sessionId = zk_htonll(req->sessionId);
         | 
| 70 | 
            +
                  memcpy(&req->passwd_len, buffer + offset, sizeof(req->passwd_len));
         | 
| 71 | 
            +
                  offset = offset +  sizeof(req->passwd_len);
         | 
| 72 | 
            +
             
         | 
| 73 | 
            +
            diff -ur zkc-3.4.5-orig/c/tests/ZKMocks.cc zkc-3.4.5/c/tests/ZKMocks.cc
         | 
| 74 | 
            +
            --- zkc-3.4.5-orig/c/tests/ZKMocks.cc	2012-09-30 13:53:32.000000000 -0400
         | 
| 75 | 
            +
            +++ zkc-3.4.5/c/tests/ZKMocks.cc	2014-07-29 03:13:59.000000000 -0400
         | 
| 76 | 
            +
            @@ -41,7 +41,7 @@
         | 
| 77 | 
            +
                 int offset=sizeof(req->protocolVersion);
         | 
| 78 | 
            +
                 
         | 
| 79 | 
            +
                 memcpy(&req->lastZxidSeen,buf.data()+offset,sizeof(req->lastZxidSeen));
         | 
| 80 | 
            +
            -    req->lastZxidSeen = htonll(req->lastZxidSeen);
         | 
| 81 | 
            +
            +    req->lastZxidSeen = zk_htonll(req->lastZxidSeen);
         | 
| 82 | 
            +
                 offset+=sizeof(req->lastZxidSeen);
         | 
| 83 | 
            +
                 
         | 
| 84 | 
            +
                 memcpy(&req->timeOut,buf.data()+offset,sizeof(req->timeOut));
         | 
| 85 | 
            +
            @@ -49,7 +49,7 @@
         | 
| 86 | 
            +
                 offset+=sizeof(req->timeOut);
         | 
| 87 | 
            +
                 
         | 
| 88 | 
            +
                 memcpy(&req->sessionId,buf.data()+offset,sizeof(req->sessionId));
         | 
| 89 | 
            +
            -    req->sessionId = htonll(req->sessionId);
         | 
| 90 | 
            +
            +    req->sessionId = zk_htonll(req->sessionId);
         | 
| 91 | 
            +
                 offset+=sizeof(req->sessionId);
         | 
| 92 | 
            +
                 
         | 
| 93 | 
            +
                 memcpy(&req->passwd_len,buf.data()+offset,sizeof(req->passwd_len));
         | 
| 94 | 
            +
            @@ -322,7 +322,7 @@
         | 
| 95 | 
            +
                 buf.append((char*)&tmp,sizeof(tmp));
         | 
| 96 | 
            +
                 tmp=htonl(timeOut);
         | 
| 97 | 
            +
                 buf.append((char*)&tmp,sizeof(tmp));
         | 
| 98 | 
            +
            -    int64_t tmp64=htonll(sessionId);
         | 
| 99 | 
            +
            +    int64_t tmp64=zk_htonll(sessionId);
         | 
| 100 | 
            +
                 buf.append((char*)&tmp64,sizeof(sessionId));
         | 
| 101 | 
            +
                 tmp=htonl(passwd_len);
         | 
| 102 | 
            +
                 buf.append((char*)&tmp,sizeof(tmp));
         | 
| Binary file |