From 8901bf17e7013a7bae6409c6eec88b7fd9ee61d8 Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Thu, 5 Nov 2020 09:43:19 +0100 Subject: [PATCH] fix error not returned (#11) --- base/url.go | 2 +- connclient.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/base/url.go b/base/url.go index 669d7c0b..199b5913 100644 --- a/base/url.go +++ b/base/url.go @@ -153,7 +153,7 @@ func (u *URL) AddControlAttribute(controlPath string) { } // RemoveControlAttribute removes a control attribute from an URL. -// We assume that the base path and control attribute are divided with a slash. +// We assume that the base path and control attribute are divided with a slash. func (u *URL) RemoveControlAttribute() { _, controlPath, ok := u.BasePathControlAttr() if !ok { diff --git a/connclient.go b/connclient.go index fbe407a4..41fb22a8 100644 --- a/connclient.go +++ b/connclient.go @@ -479,7 +479,7 @@ func (c *ConnClient) SetupUDP(u *base.URL, mode TransportMode, track *Track, rtp } if c.streamUrl != nil && *u != *c.streamUrl { - fmt.Errorf("setup has already begun with another url") + return nil, fmt.Errorf("setup has already begun with another url") } if c.streamProtocol != nil && *c.streamProtocol != StreamProtocolUDP { @@ -597,7 +597,7 @@ func (c *ConnClient) SetupTCP(u *base.URL, mode TransportMode, track *Track) (*b } if c.streamUrl != nil && *u != *c.streamUrl { - fmt.Errorf("setup has already begun with another url") + return nil, fmt.Errorf("setup has already begun with another url") } if c.streamProtocol != nil && *c.streamProtocol != StreamProtocolTCP { @@ -655,7 +655,7 @@ func (c *ConnClient) Play(u *base.URL) (*base.Response, error) { } if *u != *c.streamUrl { - fmt.Errorf("must be called with the same url used for SetupUDP() or SetupTCP()") + return nil, fmt.Errorf("must be called with the same url used for SetupUDP() or SetupTCP()") } res, err := c.Do(&base.Request{ @@ -790,7 +790,7 @@ func (c *ConnClient) LoopUDP() error { // Announce writes an ANNOUNCE request and reads a Response. func (c *ConnClient) Announce(u *base.URL, tracks Tracks) (*base.Response, error) { if c.streamUrl != nil { - fmt.Errorf("announce has already been sent with another url url") + return nil, fmt.Errorf("announce has already been sent with another url url") } res, err := c.Do(&base.Request{