client: remove DialReadContext, DialPublishContext

This commit is contained in:
aler9
2021-11-12 11:17:50 +01:00
committed by Alessandro Ros
parent 19568f2d42
commit f6601580db

View File

@@ -307,11 +307,6 @@ func (c *Client) Dial(scheme string, host string) error {
// DialRead connects to the address and starts reading all tracks.
func (c *Client) DialRead(address string) error {
return c.DialReadContext(context.Background(), address)
}
// DialReadContext connects to the address with the given context and starts reading all tracks.
func (c *Client) DialReadContext(ctx context.Context, address string) error {
u, err := base.ParseURL(address)
if err != nil {
return err
@@ -322,21 +317,6 @@ func (c *Client) DialReadContext(ctx context.Context, address string) error {
return err
}
ctxHandlerDone := make(chan struct{})
defer func() { <-ctxHandlerDone }()
ctxHandlerTerminate := make(chan struct{})
defer close(ctxHandlerTerminate)
go func() {
defer close(ctxHandlerDone)
select {
case <-ctx.Done():
c.Close()
case <-ctxHandlerTerminate:
}
}()
_, err = c.Options(u)
if err != nil {
c.Close()
@@ -368,11 +348,6 @@ func (c *Client) DialReadContext(ctx context.Context, address string) error {
// DialPublish connects to the address and starts publishing the tracks.
func (c *Client) DialPublish(address string, tracks Tracks) error {
return c.DialPublishContext(context.Background(), address, tracks)
}
// DialPublishContext connects to the address with the given context and starts publishing the tracks.
func (c *Client) DialPublishContext(ctx context.Context, address string, tracks Tracks) error {
u, err := base.ParseURL(address)
if err != nil {
return err
@@ -383,21 +358,6 @@ func (c *Client) DialPublishContext(ctx context.Context, address string, tracks
return err
}
ctxHandlerDone := make(chan struct{})
defer func() { <-ctxHandlerDone }()
ctxHandlerTerminate := make(chan struct{})
defer close(ctxHandlerTerminate)
go func() {
defer close(ctxHandlerDone)
select {
case <-ctx.Done():
c.Close()
case <-ctxHandlerTerminate:
}
}()
_, err = c.Options(u)
if err != nil {
c.Close()