MCPcopy
hub / github.com/IBM/sarama / getSockError

Method getSockError

broker.go:160–182  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

158}
159
160func (b *Broker) getSockError() error {
161 // skip socket health checks while another operation owns broker state
162 if !b.lock.TryLock() {
163 return nil
164 }
165 defer b.lock.Unlock()
166
167 if b.conn == nil {
168 return nil
169 }
170
171 conn := b.conn
172 if c, ok := conn.(*bufConn); ok {
173 conn = c.Conn
174 }
175 if c, ok := conn.(*tls.Conn); ok {
176 conn = c.NetConn()
177 }
178 if c, ok := conn.(*net.TCPConn); ok {
179 return getTCPConnSockError(c)
180 }
181 return nil
182}
183
184// Open tries to connect to the Broker if it is not already connected or connecting, but does not block
185// waiting for the connection to complete. This means that any subsequent operations on the broker will

Callers 2

checkBrokersHealthMethod · 0.80

Calls 1

getTCPConnSockErrorFunction · 0.70

Tested by

no test coverage detected