code: func (p *Provider) handleConnection(conn net.Conn) {
  	// Create an RPC server to handle inbound
  	pe := &providerEndpoint{p: p}
  	rpcServer := rpc.NewServer()
  	rpcServer.RegisterName("Client", pe)
  	rpcCodec := msgpackrpc.NewCodec(false, false, conn)
  
  	defer func() {
  		if !pe.hijacked() {
  			conn.Close()
  		}
  	}()
  
  	for !p.IsShutdown() {
  		if err := rpcServer.ServeRequest(rpcCodec); err != nil {
  			if err != io.EOF && !strings.Contains(err.Error(), "closed") {
  				p.logger.Printf("[ERR] scada-client: RPC error: %v", err)
  			}
  			return
  		}
  
  		// Handle potential hijack in Client.Connect
  		if pe.hijacked() {
  			cb := pe.getHijack()
  			cb(conn)
  			return
  		}
  	}
  }
docs: // handleConnection handles an incoming connection