Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export listener #6

Closed
brk0v opened this issue Jul 28, 2014 · 4 comments
Closed

Export listener #6

brk0v opened this issue Jul 28, 2014 · 4 comments

Comments

@brk0v
Copy link
Contributor

brk0v commented Jul 28, 2014

Hi,

It seems to be good to change listener to Listener in https://github.com/spacemonkeygo/openssl/blob/master/net.go#L22. It will be useful for extend listener. For example add custom timeouts:

type BalancerListener struct {
    openssl.Listener
    ReadTimeout  time.Duration
    WriteTimeout time.Duration
    TCPkeepAlivePeriod time.Duration
}

func (bl *BalancerListener) Accept() (c net.Conn, err error) {

    conn, err := bl.Listener.Accept()
    if err != nil {
        return
    }

    conn.SetReadDeadline(time.Now().Add(bl.ReadTimeout))
    conn.SetWriteDeadline(time.Now().Add(bl.WriteTimeout))

    return conn, nil
}
@zowens
Copy link
Contributor

zowens commented Jul 28, 2014

Why not use net.Listener instead?

@brk0v
Copy link
Contributor Author

brk0v commented Jul 28, 2014

Sorry, you are right. =)
Thank you for rapid answer. Your library is awesome.

@brk0v brk0v closed this as completed Jul 28, 2014
@zowens
Copy link
Contributor

zowens commented Jul 29, 2014

Heh, not mine. Just an enthusiast :)

@jtolio
Copy link
Member

jtolio commented Jul 29, 2014

the best kind of enthusiast 👍

nathan454 pushed a commit to nathan454/openssl that referenced this issue Nov 30, 2022
Add required bindings to support openssl in libp2p-tls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants