Removed superfluous url param from setupURL() and obtain it from the Session object instead.

This commit is contained in:
scruzin 2019-01-11 00:06:44 +10:30
parent 53bccaaaa7
commit b388f5374f
3 changed files with 5 additions and 5 deletions

View File

@ -134,8 +134,8 @@ var (
)
// setupURL parses the RTMP URL.
func setupURL(s *Session, addr string) (err error) {
s.link.protocol, s.link.host, s.link.port, s.link.app, s.link.playpath, err = parseURL(addr)
func setupURL(s *Session) (err error) {
s.link.protocol, s.link.host, s.link.port, s.link.app, s.link.playpath, err = parseURL(s.url)
if err != nil {
return err
}
@ -145,7 +145,7 @@ func setupURL(s *Session, addr string) (err error) {
s.link.tcUrl = rtmpProtocolStrings[s.link.protocol] + "://" + s.link.host + ":" + strconv.Itoa(int(s.link.port)) + "/" + s.link.app
s.link.lFlags |= RTMP_LF_FTCU
} else {
s.link.tcUrl = addr
s.link.tcUrl = s.url
}
}

View File

@ -113,7 +113,7 @@ func TestSetupURL(t *testing.T) {
if s.url != testBaseURL && s.link.timeout != testTimeout {
t.Errorf("NewSession failed")
}
err := setupURL(s, s.url)
err := setupURL(s)
if err != nil {
t.Errorf("setupURL(testBaseURL) failed with error: %v", err)
}

View File

@ -113,7 +113,7 @@ func (s *Session) Open() error {
// start does the heavylifting for Open().
func (s *Session) start() error {
s.log(DebugLevel, pkg+"Session.start")
err := setupURL(s, s.url)
err := setupURL(s)
if err != nil {
s.close()
return err