Add TestServer.TCP#58
Conversation
dc7e815 to
c76044f
Compare
75c5759 to
4e3d05e
Compare
1e0893b to
4f7a37d
Compare
77b349d to
b77449c
Compare
f5fca44 to
b796fa9
Compare
b796fa9 to
ca2fc2c
Compare
| @spec connections(TestServer.instance()) :: [map()] | ||
| def connections(instance) do | ||
| GenServer.call(instance, :connections) | ||
| end |
| @spec report_error(TestServer.instance(), {struct(), TestServer.stacktrace()}) :: :ok | ||
| def report_error(instance, {exception, stacktrace}) do | ||
| options = get_options(instance) | ||
| report_error_with_options(options, {exception, stacktrace}) | ||
| end |
There was a problem hiding this comment.
This looks weird, shouldn't it be like how it looks in HTTP and SSH? We should probably DRY it up as well after.
| report_error_with_options(state.options, {exception, stacktrace}) | ||
|
|
||
| message = Exception.format(:error, exception, stacktrace) | ||
| :gen_tcp.send(connection.socket, message) |
There was a problem hiding this comment.
I don't think we want to do any direct gen tcp stuf fhere, it should just pass-thru to the TCP layer or server if that. I think the general idea should be that instance just handles handler/match calls, while the actual execution is defined in the handler itself somewhere else. In this case we can wrap the function with gen_tcp send, or have it done after?
| state.connections | ||
| |> Enum.reduce(state, fn connection, state -> | ||
| connection | ||
| |> run_send_handler(to, stacktrace) | ||
| |> send_response(connection, state) | ||
| end) |
There was a problem hiding this comment.
This reads odd, why run it on all connections instead of just having this being single connection in the first place? I guess we can support multi connections but if we do that we should make it more explicit.
c445600 to
6a8914a
Compare
6a8914a to
0fb1390
Compare
No description provided.