Skip to content

Commit

Permalink
Fix/revert (#410)
Browse files Browse the repository at this point in the history
* Revert "Check if error is nil in proxy listener (#407)"

This reverts commit a57956d.

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>

* Revert "Fix error handling in memifproxy (#403)"

This reverts commit 792a420.

Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>
  • Loading branch information
Mixaster995 authored Oct 13, 2021
1 parent a57956d commit d541552
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions pkg/networkservice/mechanisms/memif/memifproxy/proxy_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,30 +66,23 @@ func (p *proxyListener) accept() {
defer func() { _ = p.Close() }()
for {
in, err := p.listener.Accept()
if err != nil {
if optErr, ok := err.(*net.OpError); !ok || !optErr.Temporary() {
// TODO - perhaps log this?
return
}
if optErr, ok := err.(*net.OpError); ok && !optErr.Temporary() {
// TODO - perhaps log this?
return
}

out, err := net.Dial(memifNetwork, p.socketFilename)
if err != nil {
if optErr, ok := err.(*net.OpError); !ok || !optErr.Temporary() {
_ = in.Close()
// TODO - perhaps log this?
return
}
if optErr, ok := err.(*net.OpError); ok && !optErr.Temporary() {
_ = in.Close()
// TODO - perhaps log this?
return
}

proxyConn, err := newProxyConnection(in, out)
if err != nil {
_ = in.Close()
_ = out.Close()
// TODO - perhaps log this?
return
}

// TODO - clean up - while 99% of the time this won't be an issue because we will have exactly one thing
// in this list... in principle it could leak memory
p.proxyConnections = append(p.proxyConnections, proxyConn)
Expand Down

0 comments on commit d541552

Please sign in to comment.