Reduce impact of user callbacks to socket timer

The library should update socket timer after calling user functions to
exclude this time from timeout

Change-Id: Ie0297e7d7fd855c6dab84610a1f1fb7d5111ffb0
Reviewed-on: http://review.couchbase.org/23661
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
CCBC-153 Nullify the address info to avoid doublefree

Change-Id: I15e37d8eecf0bb52fafabea93668da0664e48b4d
Reviewed-on: http://review.couchbase.org/23663
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
CCBC-159 Allow to handle large operation buffers

Function do_read_data() has internal limit for operations handled per
call and currently it is hardcoded as 1000. With conjuntion that
lcb_server_event_handler() might register itself for READ event
awaiting the data from the socket when output buffer is empty, it
leads to timeouts when the limit was reached _and_ output buffer is
empty.

This patch does the following:

* always setup RW event if either output or input buffers has the data
* check for pure write event first in the handler
* add alternative check for read event, it will be triggered either
  when READ event received or input buffer isn't empty

Change-Id: Ie62692e30b8f0c0bf00aff5b262fb2c99b609f3f
Reviewed-on: http://review.couchbase.org/23662
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
CCBC-150: Do a deep search to locate commands

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