Commit c26bd158 authored by yidong0635's avatar yidong0635 Committed by Changpeng Liu
Browse files

example/sock: avoid register poller multiple times



Timeout poller in hello_sock_quit which locates in hello_sock_accept_poll
can be registered multiple times, each poller allocates memory and
can't be freed.

fixed issue#521

Change-Id: I2730f0e53d99a525becca263c6731231adf5f64b
Signed-off-by: default avataryidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/437226


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 8db5ff2b
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -135,8 +135,10 @@ hello_sock_quit(struct hello_context_t *ctx, int rc)
{
	ctx->rc = rc;
	spdk_poller_unregister(&ctx->poller_out);
	if (!ctx->time_out) {
		ctx->time_out = spdk_poller_register(hello_sock_close_timeout_poll, ctx,
						     CLOSE_TIMEOUT_US);
	}
	return 0;
}