2
0
mirror of synced 2025-02-24 06:38:14 +00:00

The "m" field in the extended handshake is not mandatory

This commit is contained in:
Matt Joiner 2017-11-08 19:29:55 +11:00
parent 2f8a2ada2e
commit 1b9606ae75

View File

@ -892,11 +892,7 @@ func (c *connection) mainReadLoop() error {
if v, ok := d["v"]; ok {
c.PeerClientName = v.(string)
}
m, ok := d["m"]
if !ok {
err = errors.New("handshake missing m item")
break
}
if m, ok := d["m"]; ok {
mTyped, ok := m.(map[string]interface{})
if !ok {
err = errors.New("handshake m value is not dict")
@ -920,6 +916,7 @@ func (c *connection) mainReadLoop() error {
c.PeerExtensionIDs[name] = byte(id)
}
}
}
metadata_sizeUntyped, ok := d["metadata_size"]
if ok {
metadata_size, ok := metadata_sizeUntyped.(int64)