aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/small_SUITE_data/src/remote_field2.erl
blob: 35687e22ec2166cc792361532ac04e4ac243ecf6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
-module(remote_field2).

-export([handle_cast/2]).

-record(state, {tcp_socket :: inet:socket()}).

-spec handle_cast(_,_) ->
                         {noreply,_} |
                         {stop,{shutdown,connection_closed},
                          #state{tcp_socket :: port()}}.
handle_cast({send, Message}, #state{tcp_socket = TCPSocket} = State) ->
    case gen_tcp:send(TCPSocket, Message) of
        ok ->
            {noreply, State};
        {error, closed} ->
            {stop, {shutdown, connection_closed}, State}
    end.