Explorar el Código

add custom payload and warnings

Chris Bannister hace 10 años
padre
commit
2755a00db6
Se han modificado 1 ficheros con 13 adiciones y 2 borrados
  1. 13 2
      frame.go

+ 13 - 2
frame.go

@@ -9,6 +9,7 @@ import (
 	"fmt"
 	"fmt"
 	"io"
 	"io"
 	"io/ioutil"
 	"io/ioutil"
+	"log"
 	"net"
 	"net"
 	"runtime"
 	"runtime"
 	"sync"
 	"sync"
@@ -133,8 +134,10 @@ const (
 	flagWithNameValues             = 0x40
 	flagWithNameValues             = 0x40
 
 
 	// header flags
 	// header flags
-	flagCompress byte = 0x01
-	flagTracing       = 0x02
+	flagCompress      byte = 0x01
+	flagTracing       byte = 0x02
+	flagCustomPayload byte = 0x04
+	flagWarning       byte = 0x08
 )
 )
 
 
 type Consistency uint16
 type Consistency uint16
@@ -409,6 +412,14 @@ func (f *framer) parseFrame() (frame frame, err error) {
 		f.readTrace()
 		f.readTrace()
 	}
 	}
 
 
+	if f.header.flags&flagWarning == flagWarning {
+		warnings := f.readStringList()
+		// what to do with warnings?
+		for _, v := range warnings {
+			log.Println(v)
+		}
+	}
+
 	// asumes that the frame body has been read into rbuf
 	// asumes that the frame body has been read into rbuf
 	switch f.header.op {
 	switch f.header.op {
 	case opError:
 	case opError: