summaryrefslogtreecommitdiff
path: root/lib/pleroma/gun/conn.ex
blob: 906607b28b582b4c1bdfbd2d279c057b8d2575b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Pleroma: A lightweight social networking server
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only

defmodule Pleroma.Gun.Conn do
  @moduledoc """
  Struct for gun connection data
  """
  @type gun_state :: :open | :up | :down
  @type conn_state :: :init | :active | :idle

  @type t :: %__MODULE__{
          conn: pid(),
          gun_state: gun_state(),
          waiting_pids: [pid()],
          conn_state: conn_state(),
          used_by: [pid()],
          last_reference: pos_integer(),
          crf: float()
        }

  defstruct conn: nil,
            gun_state: :open,
            waiting_pids: [],
            conn_state: :init,
            used_by: [],
            last_reference: :os.system_time(:second),
            crf: 1
end