Messenger: Add unit tests

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
PipeConnection: Modify "is_connected" semantic

"is_connected" should be used to judge whether have built a successful
connection with peer. Since "pipe == NULL" is useless for whether connected
because pipe can be construct without any potential network problem

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncConnection: Avoid hungry if mark_down's caller is the eventcenter's owner

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncConnection: Avoid name conflicting with AsyncMessenger

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncMessenger: Fix accept connection replacing process

Original there exists bugs that we don't modify existing file event,
it will let remaining alive connection's event won't be called by
EventCenter.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncConnection: Add loopback connection support

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Messenger: Create an Messenger implementation by name.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
test/msgr/test_msgr: Fix potential unsafe cond wakeup and wrap check

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
PipeConnection: Avoid deadlock when calling is_connected

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncConnection: Fix time event is called after AsyncMessenger destruction

AsyncConnection uses time event to handle async event partially, but it's not
very effective so here use dispatch_event_external instead.

And if client try to connect to server after a period, it may be call
AsyncConnection::process which will reference to AsyncMessenger. Since
AsyncMessenger doesn't use reference count, it will result in segment
fault. Now we record time event id and delete these registered time events
when stopping connection.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Merge pull request #3101 from yuyuyu101/wip-10147

Messenger Unit Tests

Reviewed-by: Sage Weil <sage@redhat.com>