修改读取读取guacd内容的方式
This commit is contained in:
parent
168d11b8e3
commit
127d9ef6a1
@ -229,7 +229,7 @@ func (opt *Tunnel) WriteInstructionAndFlush(instruction Instruction) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (opt *Tunnel) WriteAndFlush(p []byte) (int, 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)
|
nn, err := opt.writer.Write(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nn, err
|
return nn, err
|
||||||
@ -250,14 +250,12 @@ func (opt *Tunnel) ReadInstruction() (instruction Instruction, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (opt *Tunnel) Read() (p []byte, err error) {
|
func (opt *Tunnel) Read() (p []byte, err error) {
|
||||||
buffer := make([]byte, 8096)
|
data, err := opt.reader.ReadBytes(Delimiter)
|
||||||
read, err := opt.reader.Read(buffer)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
buffer = buffer[0:read]
|
s := string(data)
|
||||||
s := string(buffer)
|
//fmt.Printf("<- %v \n", s)
|
||||||
fmt.Printf("<- %v \n", s)
|
|
||||||
if s == "rate=44100,channels=2;" {
|
if s == "rate=44100,channels=2;" {
|
||||||
return make([]byte, 0), nil
|
return make([]byte, 0), nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user