     end
   end
 
-  defp calc_next_backoff(current_backoff, backoff_max) do
-    next_exponential_backoff = round(current_backoff * @backoff_exponent)
+  defp calc_next_backoff(backoff_current, backoff_max) do
+    next_exponential_backoff = round(backoff_current * @backoff_exponent)
 
     if backoff_max == :infinity do
       next_exponential_backoff

        # If this is the first time we connect, then we just retry after the
        # initial backoff (there's no need to calculate backoff and so on).
        if info == :init do
          {:backoff, @initial_backoff, %{state | current_backoff: @initial_backoff}}
        else
          next_backoff = calc_next_backoff(state.current_backoff, state.opts[:backoff_max])
          {:backoff, next_backoff, %{state | current_backoff: next_backoff}}
        end
      other ->
        other

    shared_state: nil,
    # The current backoff (used to compute the next backoff when reconnecting
    # with exponential backoff)
    backoff_current: nil,
  ]

  # TODO: right now, if backoff_max is less then 500ms (=
  # @backoff_initial), we do weird stuff.
  @backoff_initial 500

  @backoff_exponent 1.5

