understand source code of node connect