Add Options message to protocol
This commit is contained in:
@@ -65,6 +65,14 @@ func (w *marshalWriter) writeResponse(data []byte) {
|
||||
w.writeBytes(data)
|
||||
}
|
||||
|
||||
func (w *marshalWriter) writeOptions(opts map[string]string) {
|
||||
w.writeUint32(uint32(len(opts)))
|
||||
for k, v := range opts {
|
||||
w.writeString(k)
|
||||
w.writeString(v)
|
||||
}
|
||||
}
|
||||
|
||||
func (r *marshalReader) readHeader() header {
|
||||
return decodeHeader(r.readUint32())
|
||||
}
|
||||
@@ -109,3 +117,14 @@ func (r *marshalReader) readRequest() request {
|
||||
func (r *marshalReader) readResponse() []byte {
|
||||
return r.readBytes()
|
||||
}
|
||||
|
||||
func (r *marshalReader) readOptions() map[string]string {
|
||||
n := r.readUint32()
|
||||
opts := make(map[string]string, n)
|
||||
for i := 0; i < int(n); i++ {
|
||||
k := r.readString()
|
||||
v := r.readString()
|
||||
opts[k] = v
|
||||
}
|
||||
return opts
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user