From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id B76FB1B2C1 for ; Wed, 9 May 2018 15:30:10 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 May 2018 06:30:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,381,1520924400"; d="scan'208";a="222877901" Received: from irsmsx107.ger.corp.intel.com ([163.33.3.99]) by orsmga005.jf.intel.com with ESMTP; 09 May 2018 06:30:08 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.150]) by IRSMSX107.ger.corp.intel.com ([169.254.10.141]) with mapi id 14.03.0319.002; Wed, 9 May 2018 14:30:07 +0100 From: "Dumitrescu, Cristian" To: Liu Hongbo , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2] examples/ip_pipeline: Support quitting CLI connection Thread-Index: AQHT547MnGDIgZugZUmupqNsyirQ4aQnYIVA Date: Wed, 9 May 2018 13:30:07 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D891267BB69346@IRSMSX108.ger.corp.intel.com> References: <1525867817-6427-1-git-send-email-cnliuhb@gmail.com> In-Reply-To: <1525867817-6427-1-git-send-email-cnliuhb@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] examples/ip_pipeline: Support quitting CLI connection X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2018 13:30:11 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Liu Hongbo > Sent: Wednesday, May 9, 2018 1:10 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v2] examples/ip_pipeline: Support quitting CLI > connection >=20 > When detecting input "quit", ip_pipeline should close connection fd. > It is convenient when using command "telnet 0 8086". >=20 > Signed-off-by: Liu Hongbo > --- > examples/ip_pipeline/conn.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/examples/ip_pipeline/conn.c b/examples/ip_pipeline/conn.c > index 9338942..44d7ff8 100644 > --- a/examples/ip_pipeline/conn.c > +++ b/examples/ip_pipeline/conn.c > @@ -222,6 +222,8 @@ data_event_handle(struct conn *conn, > } > if (len =3D=3D 0) > return 0; > + if (!strncmp(conn->buf, "quit", strlen("quit"))) > + return -2; >=20 > /* Handle input messages */ > for (i =3D 0; i < len; i++) { > @@ -316,7 +318,7 @@ conn_poll_for_msg(struct conn *conn) > status_data =3D data_event_handle(conn, fd_client); >=20 > /* Control events */ > - if (event.events & (EPOLLRDHUP | EPOLLERR | EPOLLHUP)) > + if (status_data =3D=3D -2 || event.events & (EPOLLRDHUP | EPOLLERR | > EPOLLHUP)) > status_control =3D control_event_handle(conn, fd_client); >=20 > if (status_data || status_control) > -- > 2.7.4 Hi Liu, Thanks for suggesting this, but the quit command is not necessary in the la= test IP Pipeline app. The app is a server waiting for commands from external clients, which can b= e any decent TCP client such as telnet, netcat, Perl/Python script, etc. Th= e client can be terminated at any time, but the server continues to live on= and listen for more client connections. For example, you can kill the teln= et client and then later on start another telnet session to the same app. I= t does not make sense for the client to be able to kill the server. Regards, Cristian