Skip to content

Commit

Permalink
chore: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
StarpTech committed Nov 18, 2024
1 parent f7a2412 commit 469ec64
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -752,18 +752,20 @@ func (c *subscriptionClient) close() {
}

func (c *subscriptionClient) handleAddConn(conn *connection) {
var netConn net.Conn

if tlsConn, ok := conn.netConn.(*tls.Conn); ok {
netConn := tlsConn.NetConn()
if err := c.netPoll.Add(netConn); err != nil {
c.log.Error("subscriptionClient.handleAddConn", abstractlogger.Error(err))
conn.handler.ServerClose()
return
}
} else if err := c.netPoll.Add(conn.netConn); err != nil {
netConn = tlsConn.NetConn()
} else {
netConn = conn.netConn
}

if err := c.netPoll.Add(netConn); err != nil {
c.log.Error("subscriptionClient.handleAddConn", abstractlogger.Error(err))
conn.handler.ServerClose()
return
}

c.netPollState.connections[conn.fd] = conn
c.netPollState.triggers[conn.id] = conn.fd
// when we previously had 0 connections, we will have 1 connection now
Expand Down

0 comments on commit 469ec64

Please sign in to comment.