// setConn updates the internal conn, protected by a mutex.
502313
func (w *Writer) setConn(c serverConn) {
	w.mu.Lock()
	w.conn = c
	w.mu.Unlock()
}
1236269
func (s *ConnectionsList) SetConnections(v []*string) *ConnectionsList {
	s.Connections = v
	return s
}
1170086
func (s *Integration) SetConnectionId(v string) *Integration {
	s.ConnectionId = &v
	return s
}
967835
func (o *ClientOptions) SetAutoReconnect(a bool) *ClientOptions {
	o.AutoReconnect = a
	return o
}
282395
func (s *AwsSecurityFinding) SetNetwork(v *Network) *AwsSecurityFinding {
	s.Network = v
	return s
}
509544
func (s *PutIntegrationInput) SetConnectionId(v string) *PutIntegrationInput {
	s.ConnectionId = &v
	return s
}
932445
func (sc *serverConn) resetConn(err error) {
	if err.(*Error).Status == StatusNetworkError {
		sc.conn.Close()
		sc.conn = nil
	}
}
240721
func (s *Swarm) setupConn(netConn net.Conn, isServer bool) (*Conn, error) {
	if netConn == nil {
		return nil, errors.New("nil conn")
	}

	// first, check if we already have it, to avoid constructing it
	// if it is already there
	s.connLock.Lock()
	for c := range s.conns {
		if c.netConn == netConn {
			s.connLock.Unlock()
			return c, nil
		}
	}
	s.connLock.Unlock()
	// construct the connection without hanging onto the lock
	// (as there could be deadlock if so.)

	var ssConn smux.Conn
	if s.transport != nil {
		// create a new stream muxer connection
		c, err := s.transport.NewConn(netConn, isServer)
		if err != nil {
			return nil, err
		}

		ssConn = c
	}

	// take the lock to add it to the map.
	s.connLock.Lock()
	defer s.connLock.Unlock()

	// check for it again as it may have been added already. (TOCTTOU)
	for c := range s.conns {
		if c.netConn == netConn {
			return c, nil
		}
	}

	// add the connection
	c := newConn(netConn, ssConn, s)
	s.conns[c] = struct{}{}
	return c, nil
}
838834
func (s *Interconnect) SetInterconnectName(v string) *Interconnect {
	s.InterconnectName = &v
	return s
}
767399
func (p *ConnPool) SetConnListener(l chan<- *yamux.Session) {
	p.Lock()
	defer p.Unlock()

	// Close the old listener
	if p.connListener != nil {
		close(p.connListener)
	}

	// Store the new listener
	p.connListener = l
}
294100
func (n *Network) Conn(c net.Conn) (net.Conn, error) {
	start := now()
	nc := &conn{Conn: c, network: n, readBuf: new(bytes.Buffer)}
	if err := nc.sync(); err != nil {
		return nil, err
	}
	sleep(start.Add(nc.delay).Sub(now()))
	return nc, nil
}
1176578
func (b *Broker) SetLocalConn(localConn *grpc.ClientConn) {
	b.mu.Lock()
	defer b.mu.Unlock()

	b.localConn = localConn
}
7043
func (s *VirtualInterface) SetAsn(v int64) *VirtualInterface {
	s.Asn = &v
	return s
}
306783
func (s *Server) newConn(conn net.Conn) *clientConn {
	cc := newClientConn(s)
	if s.cfg.Performance.TCPKeepAlive {
		if tcpConn, ok := conn.(*net.TCPConn); ok {
			if err := tcpConn.SetKeepAlive(true); err != nil {
				logutil.Logger(context.Background()).Error("failed to set tcp keep alive option", zap.Error(err))
			}
		}
	}
	cc.setConn(conn)
	cc.salt = util.RandomBuf(20)
	return cc
}
1094170
func (s *AssociateVirtualInterfaceInput) SetConnectionId(v string) *AssociateVirtualInterfaceInput {
	s.ConnectionId = &v
	return s
}
63273
func (s *Task) SetConnectivity(v string) *Task {
	s.Connectivity = &v
	return s
}
981128
func (s *Swarm) SetSelectConn(cs SelectConn) {
	s.handlerLock.Lock()
	defer s.handlerLock.Unlock()
	s.selectConn = cs
}