func MessToStream(mess io.ReadWriteCloser) io.ReadWriteCloser { var toret m2s_provider toret.underlying = mess toret.buffer = common.NewBufferedPipe() go func() { bts := make([]byte, 65536) defer toret.underlying.Close() defer toret.buffer.Close() for { n, err := toret.underlying.Read(bts) if err != nil { return } _, err = toret.buffer.Write(bts[:n]) if err != nil { return } } }() return &toret }
func new_vs() *virtsock { return &virtsock{common.NewBufferedPipe(), common.NewBufferedPipe()} }