minor refactor ifs.

This commit is contained in:
Miroslav Šedivý 2020-11-14 16:09:00 +01:00
parent 7c64e6068a
commit f136a31b03
2 changed files with 5 additions and 24 deletions

View File

@ -13,12 +13,7 @@ func (h *MessageHandlerCtx) boradcastCreate(session types.Session, payload *mess
} }
h.capture.StartBroadcast(payload.URL) h.capture.StartBroadcast(payload.URL)
return h.boradcastStatus(session)
if err := h.boradcastStatus(session); err != nil {
return err
}
return nil
} }
func (h *MessageHandlerCtx) boradcastDestroy(session types.Session) error { func (h *MessageHandlerCtx) boradcastDestroy(session types.Session) error {
@ -28,12 +23,7 @@ func (h *MessageHandlerCtx) boradcastDestroy(session types.Session) error {
} }
h.capture.StopBroadcast() h.capture.StopBroadcast()
return h.boradcastStatus(session)
if err := h.boradcastStatus(session); err != nil {
return err
}
return nil
} }
func (h *MessageHandlerCtx) boradcastStatus(session types.Session) error { func (h *MessageHandlerCtx) boradcastStatus(session types.Session) error {

View File

@ -12,25 +12,16 @@ func (h *MessageHandlerCtx) signalProvide(session types.Session) error {
return err return err
} }
if err := session.Send(message.SignalProvide{ return session.Send(message.SignalProvide{
Event: event.SIGNAL_PROVIDE, Event: event.SIGNAL_PROVIDE,
ID: session.ID(), ID: session.ID(),
SDP: sdp, SDP: sdp,
Lite: lite, Lite: lite,
ICE: ice, ICE: ice,
}); err != nil { })
return err
}
return nil
} }
func (h *MessageHandlerCtx) signalAnswer(session types.Session, payload *message.SignalAnswer) error { func (h *MessageHandlerCtx) signalAnswer(session types.Session, payload *message.SignalAnswer) error {
session.SetName(payload.DisplayName) session.SetName(payload.DisplayName)
return session.SignalAnswer(payload.SDP)
if err := session.SignalAnswer(payload.SDP); err != nil {
return err
}
return nil
} }