I managed to break it - the info hash from peer doesn't match my info hash, so the connection gets reset by peer. I rewrote my handshake more compactly, but now the info hash will need to be corrected once again.