| // 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. |
| // This file contains code in the impl package that we only want built for tests |
| // (it exposes public API methods that we don't want to normally expose). |
| func (c *callbackState) leaking() bool { |
| return len(c.channels) > 0 |
| func DispatcherLeaking(d rpc.Dispatcher) bool { |
| return obj.internal.callback.leaking() |
| case *testModeDispatcher: |
| return obj.realDispatcher.(*dispatcher).internal.callback.leaking() |
| panic(fmt.Sprintf("unexpected type: %T", d)) |
| cleanupDir = func(dir, helper string) { |
| parentDir, base := filepath.Dir(dir), filepath.Base(dir) |
| renamed = filepath.Join(parentDir, "helper_deleted_"+base) |
| renamed = filepath.Join(parentDir, "deleted_"+base) |
| if err := os.Rename(dir, renamed); err != nil { |
| vlog.Errorf("Rename(%v, %v) failed: %v", dir, renamed, err) |
| func WrapBaseCleanupDir(path, helper string) { |
| baseCleanupDir(path, helper) |