Skip to content
This repository was archived by the owner on Nov 28, 2024. It is now read-only.
This repository was archived by the owner on Nov 28, 2024. It is now read-only.

Hanging Connection #67

Open
Open
@MichaHoffmann

Description

@MichaHoffmann

The connection deadline is only set after smtpNewClient was called. Since smtpNewClient already wants to read 220 from the connection, a server that does not respond will result in a hanging connection.

This issue should be resolvable by moving the deadline code just after creation of the connection.

func (d *Dialer) Dial() (SendCloser, error) {
	conn, err := NetDialTimeout("tcp", addr(d.Host, d.Port), d.Timeout)
	if err != nil {
		return nil, err
	}

	if d.SSL {
		conn = tlsClient(conn, d.tlsConfig())
	}

	c, err := smtpNewClient(conn, d.Host)
	if err != nil {
		return nil, err
	}

	if d.Timeout > 0 {
		conn.SetDeadline(time.Now().Add(d.Timeout))
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions