Skip to content

why read twice in newConnection? #17

@donnol

Description

@donnol
func newConnection(d *driver) (*connection, error) {
	c := &connection{}
	c.close()
	conn, err := net.Dial("tcp", fmt.Sprintf("%s:%d", d.Host, d.Port))
	if err != nil {
		return nil, err
	}

	c.closed = false
	c.conn = conn
	c.reader = bufio.NewReader(c.conn)

	err = c.write(fmt.Sprintf("START %s %s", d.channel, d.Password))
	if err != nil {
		return nil, err
	}

	// what is the purpose?
	_, err = c.read()
	_, err = c.read()
	if err != nil {
		return nil, err
	}
	return c, nil
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions