various updates.
CDLatch introduced. Client should wait before stopping until the Socket
count down the latch.