comm_layer: minor refactoring to reduce code duplication
comm_layer: minor refactoring to reduce code duplication

(also fixed comm_connection:send_bundle_if_ready/1 with no connected socket)
scalaris-team/scalaris,caijieming-baidu/scalaris,jvf/scalaris,jvf/scalaris,jvf/scalaris,jvf/scalaris,caijieming-baidu/scalaris,scalaris-team/scalaris,jvf/scalaris,jvf/scalaris,caijieming-baidu/scalaris,scalaris-team/scalaris,caijieming-baidu/scalaris,caijieming-baidu/scalaris,jvf/scalaris,scalaris-team/scalaris,scalaris-team/scalaris,scalaris-team/scalaris,caijieming-baidu/scalaris,scalaris-team/scalaris,caijieming-baidu/scalaris,scalaris-team/scalaris