From 09f41147f6b356bd8f729184e2b568c99c7392b9 Mon Sep 17 00:00:00 2001 From: Wojciech Kozyra Date: Mon, 18 Mar 2024 10:23:38 +0100 Subject: [PATCH] Disconnect TCP connection on EOS (#4) --- README.md | 2 +- lib/membrane_tcp/sink.ex | 6 ++++++ mix.exs | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 634e5ea..844bd7c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This package provides TCP Source and Sink, that read and write to TCP sockets. Add the following line to your `deps` in `mix.exs`. Run `mix deps.get`. ```elixir - {:membrane_tcp_plugin, "~> 0.2.0"} + {:membrane_tcp_plugin, "~> 0.3.0"} ``` ## Copyright and License diff --git a/lib/membrane_tcp/sink.ex b/lib/membrane_tcp/sink.ex index 0ae9824..d198279 100644 --- a/lib/membrane_tcp/sink.ex +++ b/lib/membrane_tcp/sink.ex @@ -82,4 +82,10 @@ defmodule Membrane.TCP.Sink do @impl true defdelegate handle_setup(context, state), to: CommonSocketBehaviour + + @impl true + def handle_end_of_stream(_pad, _context, state) do + local_socket = Socket.close(state.local_socket) + {[], %{state | local_socket: local_socket}} + end end diff --git a/mix.exs b/mix.exs index be277e2..0a1c216 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Membrane.TCP.MixProject do use Mix.Project - @version "0.2.0" + @version "0.3.0" @github_url "https://github.com/membraneframework/membrane_tcp_plugin" def project do