CCBC-153 Reset internal state on lcb_connect()

This patch allows callers to use lcb_connect() multiple times to
implement reconnecting using the same lcb_t instance.

Problems
========

* After connection error all subsequent calls to lcb_connect() lead to
  segmentation violation.

* Index used to iterate over list of backup node names wasn't reset

* For systems which don't use lcb_wait() to execute the IO loop, the
  initial timer wasn't set, so that they might wait infinitely if
  error callback wasn't triggered.

Solution
========

* Reset backup node index on lcb_connect() call

* Remove connection logic from wait.c and make it generic.

Change-Id: I63a0f6591e10c103d4a3b4de656623646aaa5c62
Reviewed-on: http://review.couchbase.org/23809
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>