修改读取读取guacd内容的方式

This commit is contained in:
dushixiang 2021-11-17 20:46:06 +08:00
parent 168d11b8e3
commit 127d9ef6a1

View File

@ -229,7 +229,7 @@ func (opt *Tunnel) WriteInstructionAndFlush(instruction Instruction) error {
}
func (opt *Tunnel) WriteAndFlush(p []byte) (int, error) {
fmt.Printf("-> %v\n", string(p))
//fmt.Printf("-> %v\n", string(p))
nn, err := opt.writer.Write(p)
if err != nil {
return nn, err
@ -250,14 +250,12 @@ func (opt *Tunnel) ReadInstruction() (instruction Instruction, err error) {
}
func (opt *Tunnel) Read() (p []byte, err error) {
buffer := make([]byte, 8096)
read, err := opt.reader.Read(buffer)
data, err := opt.reader.ReadBytes(Delimiter)
if err != nil {
return
}
buffer = buffer[0:read]
s := string(buffer)
fmt.Printf("<- %v \n", s)
s := string(data)
//fmt.Printf("<- %v \n", s)
if s == "rate=44100,channels=2;" {
return make([]byte, 0), nil
}