Skip to content

Commit

Permalink
capture rogue :gun_error message from remote server shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis committed Feb 4, 2021
1 parent fa7f038 commit 9d8fd35
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ The format is based on [Keep a
Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.3.2 - 2021-02-03

### Fixed

- Fixed edge case where the remote server shutting down would not emit a
`ChannelClosed` event
- this and heartbeats caused the odd `:gun_error` atom from
[#12](https://github.com/NFIBrokerage/slipstream/issues/12)

## 0.3.1 - 2021-02-03

### Fixed
Expand Down
14 changes: 4 additions & 10 deletions lib/slipstream/connection/pipeline.ex
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,12 @@ defmodule Slipstream.Connection.Pipeline do

defp decode_message(
%{
raw_message: {:gun_down, conn, _protocol, _reason, affected_refs, _},
state: %{conn: conn, stream_ref: stream_ref}
raw_message:
{:gun_down, conn, _protocol, _reason, _affected_refs, _},
state: %{conn: conn}
} = p
) do
if stream_ref in affected_refs do
put_message(p, event(%Events.ChannelClosed{reason: :closed_by_remote}))
else
# coveralls-ignore-start
put_message(p, event(%Events.NoOp{}))

# coveralls-ignore-stop
end
put_message(p, event(%Events.ChannelClosed{reason: :closed_by_remote}))
end

defp decode_message(
Expand Down

0 comments on commit 9d8fd35

Please sign in to comment.