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)
if err := h.boradcastStatus(session); err != nil {
return err
}
return nil
return h.boradcastStatus(session)
}
func (h *MessageHandlerCtx) boradcastDestroy(session types.Session) error {
@ -28,12 +23,7 @@ func (h *MessageHandlerCtx) boradcastDestroy(session types.Session) error {
}
h.capture.StopBroadcast()
if err := h.boradcastStatus(session); err != nil {
return err
}
return nil
return h.boradcastStatus(session)
}
func (h *MessageHandlerCtx) boradcastStatus(session types.Session) error {

View File

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