-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: use temporary instead of transient restart for Kadabra.Supervisor * feat: removed StreamSupervisor Part of a supervision restructuring. Connection will basically monitor everything except ConnectionQueue. * feat: Hpack and Socket brought under Connection * feat: all new process hierarchy Removed GenStage completely. ConnectionQueue is replaced with ConnectionPool, which will (eventually) maintain clones of Connection for better parallelism. * fix: pass tests for elixir 1.4.5 * fix: handle :connection_error shutdowns * refactor: minor changes Also: added elixir 1.7.0 to travis * refactor: module dependency restructuring - Encodable implementations moved into Encodable - Frame.Flags broken back out into each frame - Connection.Egress for sending outbound frames * test: removed some useless tests * fix: removed unnecessary Process.monitor of streams by connection Also: GOAWAY logging disabled by default, can be re-enabled with `:debug_log?` config option.
- Loading branch information
Showing
38 changed files
with
575 additions
and
760 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,4 @@ erl_crash.dump | |
# Also ignore archive artifacts (built via "mix archive.build"). | ||
*.ez | ||
|
||
mix.lock | ||
.iex.exs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
defmodule Kadabra.Connection.Egress do | ||
@moduledoc false | ||
|
||
alias Kadabra.{Encodable, Error, Frame, Socket} | ||
|
||
alias Kadabra.Frame.{ | ||
Goaway, | ||
Ping, | ||
WindowUpdate | ||
} | ||
|
||
def send_goaway(socket, stream_id) do | ||
bin = stream_id |> Goaway.new() |> Encodable.to_bin() | ||
Socket.send(socket, bin) | ||
end | ||
|
||
def send_goaway(socket, stream_id, error, reason) do | ||
code = <<Error.code(error)::32>> | ||
|
||
bin = | ||
stream_id | ||
|> Goaway.new(code, reason) | ||
|> Encodable.to_bin() | ||
|
||
Socket.send(socket, bin) | ||
end | ||
|
||
def send_ping(socket) do | ||
bin = Ping.new() |> Encodable.to_bin() | ||
Socket.send(socket, bin) | ||
end | ||
|
||
def send_local_settings(socket, settings) do | ||
bin = | ||
%Frame.Settings{settings: settings} | ||
|> Encodable.to_bin() | ||
|
||
Socket.send(socket, bin) | ||
end | ||
|
||
@spec send_window_update(pid, non_neg_integer, integer) :: no_return | ||
def send_window_update(socket, stream_id, bytes) | ||
when bytes > 0 and bytes < 2_147_483_647 do | ||
bin = | ||
stream_id | ||
|> WindowUpdate.new(bytes) | ||
|> Encodable.to_bin() | ||
|
||
# Logger.info("Sending WINDOW_UPDATE on Stream #{stream_id} (#{bytes})") | ||
Socket.send(socket, bin) | ||
end | ||
|
||
def send_window_update(_socket, _stream_id, _bytes), do: :ok | ||
|
||
def send_settings_ack(socket) do | ||
bin = Frame.Settings.ack() |> Encodable.to_bin() | ||
Socket.send(socket, bin) | ||
end | ||
end |
Oops, something went wrong.