mirror of https://bitbucket.org/ausocean/av.git
revid: making handSendFail functions for senders work as they should as appropriate - e.g. rtmp handleSendFail will attempt to restart connection
This commit is contained in:
parent
6a8423bfe6
commit
85401c8df4
|
@ -79,7 +79,11 @@ func (s *multiSender) Write(d []byte) (int, error) {
|
|||
if s.owner.config.SendRetry {
|
||||
for err != nil {
|
||||
s.owner.config.Logger.Log(logger.Warning, "send failed", "output", i, "error", err)
|
||||
sender.handleSendFail(err)
|
||||
err = sender.handleSendFail(err)
|
||||
if err != nil {
|
||||
s.owner.config.Logger.Log(logger.Warning, "could not currenty handle send fail", "output", i, "error", err)
|
||||
continue
|
||||
}
|
||||
err = sender.send()
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +131,7 @@ type loadSender interface {
|
|||
close() error
|
||||
|
||||
// handleSendFail performs any actions necessary in response to a failed send.
|
||||
handleSendFail(err error)
|
||||
handleSendFail(err error) error
|
||||
}
|
||||
|
||||
// restart is an optional interface for loadSenders that
|
||||
|
@ -166,7 +170,7 @@ func (s *fileSender) close() error {
|
|||
return s.file.Close()
|
||||
}
|
||||
|
||||
func (s *fileSender) handleSendFail(err error) {}
|
||||
func (s *fileSender) handleSendFail(err error) error { return nil }
|
||||
|
||||
// mtsSender implemented loadSender and provides sending capability specifically
|
||||
// for use with MPEGTS packetization. It handles the construction of appropriately
|
||||
|
@ -245,7 +249,7 @@ func (s *mtsSender) release() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *mtsSender) handleSendFail(err error) {}
|
||||
func (s *mtsSender) handleSendFail(err error) error { return nil }
|
||||
|
||||
// httpSender implements loadSender for posting HTTP to NetReceiver
|
||||
type httpSender struct {
|
||||
|
@ -331,7 +335,7 @@ func (s *httpSender) release() {}
|
|||
|
||||
func (s *httpSender) close() error { return nil }
|
||||
|
||||
func (s *httpSender) handleSendFail(err error) {}
|
||||
func (s *httpSender) handleSendFail(err error) error { return nil }
|
||||
|
||||
// rtmpSender implements loadSender for a native RTMP destination.
|
||||
type rtmpSender struct {
|
||||
|
@ -413,7 +417,9 @@ func (s *rtmpSender) close() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *rtmpSender) handleSendFail(err error) {}
|
||||
func (s *rtmpSender) handleSendFail(err error) error {
|
||||
return s.restart()
|
||||
}
|
||||
|
||||
// TODO: Write restart func for rtpSender
|
||||
// rtpSender implements loadSender for a native udp destination with rtp packetization.
|
||||
|
@ -450,4 +456,4 @@ func (s *rtpSender) send() error {
|
|||
return err
|
||||
}
|
||||
|
||||
func (s *rtpSender) handleSendFail(err error) {}
|
||||
func (s *rtpSender) handleSendFail(err error) error { return nil }
|
||||
|
|
Loading…
Reference in New Issue