blob: 62993d10e0fde302be2ff5f2352ae591b1ee6974 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package server
import (
wire ""
// ConflictManager RPC methods
func (d *database) StartConflictResolver(ctx *context.T, call wire.ConflictManagerStartConflictResolverServerCall) error {
if !d.exists {
return verror.New(verror.ErrNoExist, ctx,
// Store the conflict resolver connection in the per-database singleton
// so that sync can access it.
vlog.VI(2).Infof("cr: StartConflictResolver: resolution stream established")
d.crStream = call
// In order to keep the CrStream alive, we must block here until the context
// for this RPC is cancelled or closed.
// The channel is closed. Remove the crStream instance from cache.
// NOTE: Any code that accesses crStream must make a copy of the pointer
// before using it to make sure that the value does not suddenly become nil
// during their processing.
d.crStream = nil
return nil