|
40 | 40 | close/2, stop/1, send/5,
|
41 | 41 | send_eof/2]).
|
42 | 42 |
|
43 |
| --export([open_channel/6, request/6, request/7, global_request/4, event/2, |
| 43 | +-export([open_channel/6, reply_request/3, request/6, request/7, global_request/4, event/2, |
44 | 44 | cast/2]).
|
45 | 45 |
|
46 | 46 | %% Internal application API and spawn
|
@@ -95,6 +95,9 @@ request(ConnectionManager, ChannelId, Type, true, Data, Timeout) ->
|
95 | 95 | request(ConnectionManager, ChannelId, Type, false, Data, _) ->
|
96 | 96 | cast(ConnectionManager, {request, ChannelId, Type, Data}).
|
97 | 97 |
|
| 98 | +reply_request(ConnectionManager, Status, ChannelId) -> |
| 99 | + cast(ConnectionManager, {reply_request, Status, ChannelId}). |
| 100 | + |
98 | 101 | global_request(ConnectionManager, Type, true = Reply, Data) ->
|
99 | 102 | case call(ConnectionManager,
|
100 | 103 | {global_request, self(), Type, Reply, Data}) of
|
@@ -443,6 +446,16 @@ handle_cast({request, ChannelId, Type, Data}, State0) ->
|
443 | 446 | lists:foreach(fun send_msg/1, Replies),
|
444 | 447 | {noreply, State};
|
445 | 448 |
|
| 449 | +handle_cast({reply_request, Status, ChannelId}, #state{connection_state = |
| 450 | + #connection{channel_cache = Cache}} = State0) -> |
| 451 | + State = case ssh_channel:cache_lookup(Cache, ChannelId) of |
| 452 | + #channel{remote_id = RemoteId} -> |
| 453 | + cm_message({Status, RemoteId}, State0); |
| 454 | + undefined -> |
| 455 | + State0 |
| 456 | + end, |
| 457 | + {noreply, State}; |
| 458 | + |
446 | 459 | handle_cast({global_request, _, _, _, _} = Request, State0) ->
|
447 | 460 | State = handle_global_request(Request, State0),
|
448 | 461 | {noreply, State};
|
|
0 commit comments