Skip to content

Commit

Permalink
Merge pull request #35 from mediainbox/fix-reconnect-icecast
Browse files Browse the repository at this point in the history
fix: ignore icecast connection status in reconnect logic when failed to connect
  • Loading branch information
cdgraff authored Aug 31, 2017
2 parents d6de845 + 36da8ca commit 4044975
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
11 changes: 7 additions & 4 deletions js/src/streammachine/sources/proxy.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/src/streammachine/sources/proxy.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions src/streammachine/sources/proxy.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ module.exports = class ProxySource extends require("./base")
setTimeout @checkStatus, 30000

@ireq.once "error", (err) =>
debug "Gor icecast stream error #{err}, reconnecting"
debug "Got icecast stream error #{err}, reconnecting"
@_niceError err
@reconnect()
@reconnect(true)

# outgoing -> Stream
@on "_chunk", @broadcastData
Expand Down Expand Up @@ -166,8 +166,10 @@ module.exports = class ProxySource extends require("./base")

#----------

reconnect: =>
return unless @connected
reconnect: (ignoreConnectionStatus = false) =>
# Ignore reconnection if there is an active connection or the "ignore status" flag given is false
if !@connected && !ignoreConnectionStatus
return

msWaitToConnect = 5000
debug "Reconnect to Icecast source from #{@url} in #{msWaitToConnect}ms"
Expand Down

0 comments on commit 4044975

Please sign in to comment.