func OpenChannel(socketPath string, version string) *channel.RelentlessChannel {
	return channel.NewRelentlessChannel(
		func() (*channel.Channel, func()) {
			sd, err := ptypes.MarshalAny(&fcpb.StartupData{Pid: int64(os.Getpid()), Version: version})
			if err != nil {
				log.Fatalf("unable to marshal StartupData: %v", err)
			}
			m := &fspb.Message{
				MessageType: "StartupData",
				Destination: &fspb.Address{ServiceName: "system"},
				Data:        sd,
			}
		L:
			for {
				ch, fin := buildChannel(socketPath)
				if ch == nil {
					return ch, fin
				}
				select {
				case e := <-ch.Err:
					log.Errorf("Channel failed with error: %v", e)
					fin()
					continue L
				case ch.Out <- m:
					return ch, fin
				}
			}
		})
}
OpenChannel creates a channel.RelentlessChannel to a fleetspeak client
through an agreed upon unix domain socket.
package client
import (
	"os"
	"time"
	log "github.com/golang/glog"
	"github.com/golang/protobuf/ptypes"
	"github.com/google/fleetspeak/fleetspeak/src/client/channel"
	fcpb "github.com/google/fleetspeak/fleetspeak/src/client/channel/proto/fleetspeak_channel"
	fspb "github.com/google/fleetspeak/fleetspeak/src/common/proto/fleetspeak"
)
const (
	maxChannelRetryDelay      = 15 * time.Second
	channelRetryBackoffFactor = 1.5
)
func backOffChannelRetryDelay(currentDelay time.Duration) time.Duration {
	newDelay := time.Duration(float64(currentDelay) * channelRetryBackoffFactor)
	if newDelay > maxChannelRetryDelay {
		return maxChannelRetryDelay
	} else {
		return newDelay
	}
}