avoid the situation when empty connection_ptr is returned
capture by value