Exemplo n.º 1
0
func dustProxy(dustSide *Dust.RawStreamConn, plainSide *net.TCPConn) error {
	var ctl proc.Ctl
	penv := proc.InitChild(nil, &ctl, noProcess)
	_ = proc.InitHelper(penv, managedCopy(plainSide, dustSide, 4096))
	_ = proc.InitHelper(penv, managedCopy(dustSide, plainSide, 4096))
	ctl.Start()
	_ = <-ctl.Exit
	err := ctl.Status()
	log.Info("closing")
	dustSide.Close()
	plainSide.Close()
	log.Info("done: %v", err)
	return err
}
Exemplo n.º 2
0
func (ic *incoming) Init(
	parent *proc.Env,
	uniform interruptibleWriter,
	visible io.Reader,
	decoder Decoder,
) {
	*ic = incoming{
		decoder: decoder,
		uniform: uniform,
		visible: visible,

		inBuf:   make([]byte, 0, incomingBufSize),
		pushBuf: make([]byte, 0, incomingBufSize),
	}

	proc.InitHelper(parent, ic.runIncoming)
}