[server]: Don't scan output buffer if NULL

Change-Id: I88226b3c25f4a44b57a5a8060d19e08639f46323
Reviewed-on: http://review.couchbase.org/28280
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
[iocp] various fixes

- Properly handle send_error:
    Set proper code and socket structure for its overlapped field

- Handle SO_UPDATE_CONNECT_CONTEXT failures:
    We sometimes get WSAENOTSOCK on this one

- Add WSAENOTSOCK to error list for w32err_2errno

- Fix socket leakage for each socket created (ouch!)

Change-Id: Ice2f451dad1e862fd6800df669b4af9b8c13a81b
Reviewed-on: http://review.couchbase.org/28281
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
[connect timers]: Check if timer was active

Before cancelling it :)

Change-Id: I2ba119b7e32cddc5255b52ae4d012ea223ea3b13
Reviewed-on: http://review.couchbase.org/28282
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Don't check output if NULL

Change-Id: I774a906142f0668ac42f4b8246c562a8898064be
Reviewed-on: http://review.couchbase.org/28283
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
[bconf] Overhaul

This cleans up the bucketconfig code; breakouts and error propagation
are done from the I/O handlers rather than the parsing handlers. This
allows the I/O handlers to more easily cancel the timeouts if necessary.

Among the additions:

- New lcb_cntl operation for a configuration timeout (5 seconds by
  default)
- 'bconf_provider' module, where most of the bucket config updating is
  done
- Move stuff from bconf_parse over to bconf_io where it affects instance
  state and likewise.

Change-Id: I1a31d990b7333e1691855eb311bbec48b71b8a21
Reviewed-on: http://review.couchbase.org/28284
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
[http] Don't treat graceful close as an error

Now that we're sending Connection: close, it's perfectly fine (and in
fact, anticipated) that the server should close the connection when it's
ready. In this case, we need to consider it a success iff the parser has
finished too.

- Added LCB_SOCKRW_SHUTDOWN (technically, 0 means one of the two streams
  has been closed, so it's not technically a close in TCP parlance)

Change-Id: I126565c50cf3dbe9bc2ba79445bc8fd80e85962c
Reviewed-on: http://review.couchbase.org/28285
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Always include lcbuv source code in dist

Change-Id: I449fa1a0548ebf67992db7feb695823f791cc7ab
Reviewed-on: http://review.couchbase.org/28286
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
[connect] don't set timeout handler to null after firing

Change-Id: Ie474b0d66cf8c9dcf921913a1c1ee476f21117fe
Reviewed-on: http://review.couchbase.org/28288
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
[test-failover]: make dummy timer for iocp

We can't just run the event loop as the IOCP plugin will complain about
a timeout not being set. Let's make a dummy lcb_timer_t so it won't
complain

Change-Id: Ic624c1c48552a537f1c0cef9d8663f62f737de1b
Reviewed-on: http://review.couchbase.org/28289
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Allow user to call lcb_connect() several times safely

Change-Id: I2937ddbcb38d7ab716807a8d8a65bfb5a5a3cc10
Reviewed-on: http://review.couchbase.org/28303
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Mark Nunberg <mnunberg@haskalah.org>
Update CLEANFILES list

Change-Id: Ia53dfeb603fc5a68e5f07c4eaa105f4154dffc45
Reviewed-on: http://review.couchbase.org/28318
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Cancel delay connection timers in lcb_wait()

Also use lcb_wait in MockUnitTest.testBufferRelocationOnNodeFailover
At this moment we don't have enough public API to implement lcb_wait()
on the user's side completely. So it is better not to use raw
IO-objects in the timeout-sensitive tests

Change-Id: I77544f55215101770e1dd59bc2bdd0d9cda8d4de
Reviewed-on: http://review.couchbase.org/28312
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Add 'v1' plugin structure into man page

Change-Id: Ibb19d9bf0b164bdb840120e56e40c109b34b9a23
Reviewed-on: http://review.couchbase.org/28329
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Do not call lcb_server_send_packets() for each relocated packet

This function will be called per-server after relocation

Change-Id: Ieee91013c02d65d5fc484a63038572d2ba280d72
Reviewed-on: http://review.couchbase.org/28330
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Fix defaults for LCB_DURABILITY_INTERVAL in man

Change-Id: If483f18f9762ef681616a0b77ae1236a86a2049f
Reviewed-on: http://review.couchbase.org/28331
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Package libuv with windows binary package

Change-Id: If8a8aa948db6c3e2e27aba5fe638095564fafa4b
Reviewed-on: http://review.couchbase.org/28336
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Update meta for release 2.1.0

Package version will be 2.1.0
Library version will be 2.0.8, because it is still backward-compatible
with all 2.x versions

Change-Id: I495e1037332fada0efdb9a3b88bb72a17c796059
Reviewed-on: http://review.couchbase.org/28332
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
CCBC-239 Do not use socket after failout

Change-Id: I42c80cb8156354d2ad0e24954ff099d64fbb2a05
Reviewed-on: http://review.couchbase.org/28392
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Mark Nunberg <mnunberg@haskalah.org>
CCBC-245 Generate debug for release build

It also reverts /OPT defaults so that it won't degrade performance and
size

Reference: http://msdn.microsoft.com/en-us/library/xe4t6fc1(v=vs.80).aspx
Reference: http://msdn.microsoft.com/en-us/library/958x11bc.aspx
Change-Id: I38930bfd8343be5a80f74eb639054d4e073a92a0
Reviewed-on: http://review.couchbase.org/28386
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
CCBC-248 Do not disable config.h on UNIX-like platforms

Change-Id: Ie2b4c9af600846e220afd781b75a8073bc6582aa
Reviewed-on: http://review.couchbase.org/28404
Reviewed-by: Mark Nunberg <mnunberg@haskalah.org>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>