bootstrap: Check before scheduling async

Fixes a memory leak

Change-Id: Ie6de8904f52e0cc3452616d50f53b4680b2b5484
Reviewed-on: http://review.couchbase.org/32630
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Fixup copying in MockResponse

This copies pointers and causes accidental double-frees

Change-Id: If35ef6e62fae56a23eeeb8cf352e09765f2f791b
Reviewed-on: http://review.couchbase.org/32633
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
bc_http: Delay timer when stream bytes have arrived

Change-Id: I08e568bdf4457a647d534cfc940edde91c7604b0
Reviewed-on: http://review.couchbase.org/32635
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Don't include win_stdint if not on MSVC

Change-Id: I17ff761d92479026354669e9cb7c99f7eff4a752
Reviewed-on: http://review.couchbase.org/32585
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Set VERSION.in variable names correctly

Change-Id: I2aeb4ba05091872ed609f9bd5a9458cd23432f49
Reviewed-on: http://review.couchbase.org/32557
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Decouple lcb_N_t from versioning info

Change-Id: Ie63ac7f13b31ebefbff7efb47aed8075f2aa8904
Reviewed-on: http://review.couchbase.org/32558
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
libev: Normalize timer handling

Fixes some bad memory access issues

Change-Id: I89ba77c95b2f5aa48c05841e4bf978e6b66e6eef
Reviewed-on: http://review.couchbase.org/32632
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
cast to unsigned long before printing hrtime

Change-Id: I3af250bfcca09bd76c49c8cf5b0868543e62d83f
Reviewed-on: http://review.couchbase.org/32751
Reviewed-by: Mark Nunberg <mnunberg@haskalah.org>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Move timer stuff over to its own header file

Change-Id: I6d99e887736eeb28747664d15fe4c63db40dd9c8
Reviewed-on: http://review.couchbase.org/32825
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Decouple lcb_connection_st structure

- Connection structure now owns the addrinfo stuff
- No timers in connection structure except for initial connect
- connection_start requires a hostname and a set of handlers
- extended timer API. No more 'update_timer' and 'delete_timer'
- Connection startup info dropped after successful connecton

Change-Id: I162e3a45ac22dccd876ca63a7c4623297215a3cf
Reviewed-on: http://review.couchbase.org/32836
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Connection Manager/Socket Pool

This introduces a connection manager with pooling options to allow for
better utilization and caching of sockets

Change-Id: Ia2b306f000d01a9443589b0cba2a45b5205a9319
Reviewed-on: http://review.couchbase.org/32789
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Fixup some build failures/warnings on win32

Change-Id: I21729495dc864f1737b7999aca1eabb143bad5c7
Reviewed-on: http://review.couchbase.org/32984
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
server_negotiate: always release ringbuffer

Otherwise, memory will leak

Change-Id: I5f1ae990c57cd9ed090f482ac44070ffd8036383
Reviewed-on: http://review.couchbase.org/32878
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Utilize connection pool for memcached sockets

This eliminates extra connections for memcached when using CCCP sockets.
In other words, CCCP no longer allocates its own "Private" socket, but
rather releases its private connection to the pool once it has completed
using it.

Additionally, cccp will now use existing memcached sockets for cluster
information (if so required) rather than creating new sockets from the
pool

Change-Id: I9c8fe908248d96103672915474f048720e1b9e3d
Reviewed-on: http://review.couchbase.org/32883
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Provide time-based threshold for resetting configuration

This provides a time-based threshold so that low-use modes can get
configuration refreshes fairly quickly

Change-Id: If1de2d8b380a4823e95ddb0c608c842d5e19f7be
Reviewed-on: http://review.couchbase.org/32893
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
bc_file: Check if buffer is empty

Change-Id: Ife945f74098f3f5ef2138c4e1f861394c20fb3a6
Reviewed-on: http://review.couchbase.org/32910
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
bootstrap: don't maintain config for TYPE_CLUSTER

We don't need it, and it causes some other assumptions and tests to
fail. In reality this is a hack, but other than making an entirely new
codepath for admin connections, this is the best we can do right now

Change-Id: If5ddd5c9e034e3ddecc681a86d0f6e8a749099d1
Reviewed-on: http://review.couchbase.org/32911
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
confmon: don't poison clconfig memory space

We already have an assertion at the top telling us that the refcount
must be > 0

Change-Id: Ie4a508072fadec6a33533314ad4397cfcd67d55a
Reviewed-on: http://review.couchbase.org/32912
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
readwrite-easy: Don't invoke error callback if bytes were read

This allows us to swallow the entire read buffer contents and only
complain if we've had a close WITHOUT data.

Change-Id: Ib7601d696e826af13ce35cdec5d9abf450a25303
TODO: Maybe place this inside sockrw_v0 read itself?
Reviewed-on: http://review.couchbase.org/32914
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Add environment variable to disable CCCP

In testing environments with either mock or cluster_run, port 11210 may
not exist, or worse, may be part of a different cluster than intended.

While in the unit tests in LCB we manually specify the memcached ports,
this may not be possible with wrapping SDKs, especially of older
versions

Change-Id: Ib1a5499ec08b698dbcf9139d7321628ba4d85d0c
Reviewed-on: http://review.couchbase.org/32915
Reviewed-by: Brett Lawson <brett19@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>