Skip to content

Commit

Permalink
RTC-512 Add Room.State module and peer disconnected timeout (#178)
Browse files Browse the repository at this point in the history
* Add Room.State module

* WiP

* OpenApi changes

* Fix test

* Update type

* Fix type of peer

* Send RoomDeleted after peerlessPurge

* Fix tests

* Update lib/jellyfish_web/api_spec/room.ex

Co-authored-by: Przemysław Rożnawski <[email protected]>

* Move Event.broadcast_server_notification to State module and telemetry.execute

* Update openapi spec

* Add logs in peer_socket.ex

* Add peer_id metadata in logger

---------

Co-authored-by: Przemysław Rożnawski <[email protected]>
  • Loading branch information
Rados13 and roznawsk authored Apr 17, 2024
1 parent 67bf454 commit 9cfc3e0
Show file tree
Hide file tree
Showing 14 changed files with 818 additions and 383 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.lexical/*
compile_commands.json
.gdb_history
bundlex.sh
Expand Down
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ config :membrane_telemetry_metrics, enabled: true

config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id, :room_id]
metadata: [:request_id, :room_id, :peer_id]

config :logger_json, :backend,
metadata: [:request_id, :room_id],
Expand Down
12 changes: 10 additions & 2 deletions lib/jellyfish/peer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ defmodule Jellyfish.Peer do
:type,
:engine_endpoint
]
defstruct @enforce_keys ++ [status: :disconnected, socket_pid: nil, tracks: %{}, metadata: nil]
defstruct @enforce_keys ++
[
status: :disconnected,
socket_pid: nil,
tracks: %{},
metadata: nil,
last_time_connected: nil
]

@type id :: String.t()
@type peer :: WebRTC
Expand All @@ -32,7 +39,8 @@ defmodule Jellyfish.Peer do
socket_pid: pid() | nil,
engine_endpoint: Membrane.ChildrenSpec.child_definition(),
tracks: %{Track.id() => Track.t()},
metadata: any()
metadata: any(),
last_time_connected: integer() | nil
}

@spec parse_type(String.t()) :: {:ok, peer()} | {:error, :invalid_type}
Expand Down
Loading

0 comments on commit 9cfc3e0

Please sign in to comment.