mongo-utils: Fix parsing addresses without a port name

When the address does not have a port, set the output port parameter to
-1. This fixes #24.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
mongo-sync: Only close the FD on reconnect if needed

When reconnecting and replacing the old FD with the new, only close the
old one if it is different from the new, otherwise we will end up
closing the new socket too. This fixes #25.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
mongo-utils: Allow -1 as port in mongo_util_parse_addr()

When using replica-sets with unix domain sockets, we end up putting
paths with -1 ports into the internal seed list. mongo_connect()
understands that, but mongo_util_parse_addr() needs to handle that
similarly too. To this end, allow -1 (MONGO_CONN_LOCAL) when parsing
addresses.

This really fixes #24.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
mongo-sync: Fix a memory leak

When _mongo_sync_packet_send() is called, all callers expect the passed
packet to get free()'d in all cases. This did not happen if we had
force_master set, and _mongo_cmd_ensure_conn() failed. This patch fixes
this path too, and fixes #26.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
mongo-sync: make it possible to use recovery cache from an external project

Recovery cache definition is an internal, private definition
(and we don't want to change it).

This patch:
- adds a constructor-like method (_new) instead of init,
  which creates the cache object dynamically by allocating memory on the heap

- adds a destructor-like method(_free) instead of discard

Signed-off-by: Budai Laszlo <lbudai@balabit.hu>
Merge pull request #27 from lbudai/f/failover_refact

mongo-sync: make it possible to use recovery cache from an external proj...
.travis.yml: Enable symbol versioning on Travis CI

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
mongo-sync: save last error for future use

Signed-off-by: Budai Laszlo <lbudai@balabit.hu>
Merge branch 'f/last_error_refact'
tests: Fix a func test to work without a replica set

When working with a single MongoDB instance, properly skip newly added
tests in tests/func/mongo/sync/f_sync_auto_reconnect_cache.c.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>