From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1FAt-0006as-U3 for qemu-devel@nongnu.org; Tue, 14 Aug 2012 07:20:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1FAs-0000i4-Jt for qemu-devel@nongnu.org; Tue, 14 Aug 2012 07:20:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54249) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1FAs-0000hg-Bx for qemu-devel@nongnu.org; Tue, 14 Aug 2012 07:20:38 -0400 From: Juan Quintela In-Reply-To: <87vcgraz3e.fsf@blackfin.pond.sub.org> (Markus Armbruster's message of "Fri, 10 Aug 2012 11:13:57 +0200") References: <1344354826-10375-1-git-send-email-lcapitulino@redhat.com> <1344354826-10375-16-git-send-email-lcapitulino@redhat.com> <87vcgraz3e.fsf@blackfin.pond.sub.org> Date: Tue, 14 Aug 2012 13:19:37 +0200 Message-ID: <87k3x1wwja.fsf@elfo.mitica> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 15/35] migration: don't rely on any QERR_SOCKET_* Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, aliguori@us.ibm.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, pbonzini@redhat.com, Luiz Capitulino , eblake@redhat.com Markus Armbruster wrote: > Luiz Capitulino writes: > >> Use the in_progress argument for QERR_SOCKET_CONNECT_IN_PROGRESS. The >> other errors are handled the same by checking if the error is set and >> then calling migrate_fd_error() if it's. >> >> It's also necessary to change inet_connect_opts() not to set >> QERR_SOCKET_CONNECT_IN_PROGRESS. This error is only used by >> tcp_start_outgoing_migration() and not changing it along with the >> usage of in_progress would break migration. >> >> Furthermore this commit fixes a bug. Today, there's a spurious error >> report when migration succeeds: >> >> (qemu) migrate tcp:0:4444 >> migrate: Connection can not be completed immediately >> (qemu) >> >> After this commit no spurious error is reported anymore. >> >> Signed-off-by: Luiz Capitulino > > I'd prefer > > s->fd = inet_connect(host_port, false, &in_progress, errp); > if (error_is_set(errp)) { > migrate_fd_error(s); > return -1; > } > if (in_progress) { > DPRINTF("connect in progress\n"); > qemu_set_fd_handler2(s->fd, NULL, NULL, tcp_wait_for_connect, s); > } else { > migrate_fd_connect(s); > } > return 0; > > because it separates abnormal and normal code paths more clearly. > > Matter of taste. The 1st migrate_fd_error() is not needed (it was already wrong). migrate_fd_* functions are supposed to be called only after migrate_fd_connect() has been called. Later, Juan.