aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-07-24 16:22:26 +0200
committerLoïc Hoguin <[email protected]>2019-07-24 16:22:26 +0200
commit3d1e3c9e6e779bca839b86717adb2487b4a1c2c6 (patch)
tree488db6e9ea303d8866eb2affc706d2162a9deb70 /src/gun.erl
parent8c6adf73d9d3fa1ebb49d4b9bd71caab1815dcb2 (diff)
downloadgun-3d1e3c9e6e779bca839b86717adb2487b4a1c2c6.tar.gz
gun-3d1e3c9e6e779bca839b86717adb2487b4a1c2c6.tar.bz2
gun-3d1e3c9e6e779bca839b86717adb2487b4a1c2c6.zip
Add the cancel event for local/remote stream cancellation
Diffstat (limited to 'src/gun.erl')
-rw-r--r--src/gun.erl10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gun.erl b/src/gun.erl
index b55d3a1..9add685 100644
--- a/src/gun.erl
+++ b/src/gun.erl
@@ -973,10 +973,12 @@ connected(info, {connect_protocol, Protocol}, #state{protocol=Protocol}) ->
keep_state_and_data;
connected(info, {connect_protocol, Protocol}, State=#state{protocol_state=ProtoState}) ->
commands([{switch_protocol, Protocol, ProtoState}], State);
-connected(cast, {cancel, ReplyTo, StreamRef},
- State=#state{protocol=Protocol, protocol_state=ProtoState}) ->
- ProtoState2 = Protocol:cancel(ProtoState, StreamRef, ReplyTo),
- {keep_state, State#state{protocol_state=ProtoState2}};
+connected(cast, {cancel, ReplyTo, StreamRef}, State=#state{
+ protocol=Protocol, protocol_state=ProtoState,
+ event_handler=EvHandler, event_handler_state=EvHandlerState0}) ->
+ {ProtoState2, EvHandlerState} = Protocol:cancel(ProtoState,
+ StreamRef, ReplyTo, EvHandler, EvHandlerState0),
+ {keep_state, State#state{protocol_state=ProtoState2, event_handler_state=EvHandlerState}};
%% Public Websocket interface.
%% @todo Maybe make an interface in the protocol module instead of checking on protocol name.
%% An interface would also make sure that HTTP/1.0 can't upgrade.