Skip to content

Dead Code #119

@lychjck

Description

@lychjck

`

// Write breaks down a L2CAP SDU into segmants [Vol 3, Part A, 7.3.1]

func (c *Conn) Write(sdu []byte) (int, error) {
if len(sdu) > c.txMTU {
return 0, errors.Wrap(io.ErrShortWrite, "payload exceeds mtu")
}
plen := len(sdu)
if plen > c.txMTU {
plen = c.txMTU
}
b := make([]byte, 4+plen)
binary.LittleEndian.PutUint16(b[0:2], uint16(len(sdu)))
binary.LittleEndian.PutUint16(b[2:4], cidLEAtt)
if c.leFrame {
binary.LittleEndian.PutUint16(b[4:6], uint16(len(sdu)))
copy(b[6:], sdu)
} else {
copy(b[4:], sdu)
}
sent, err := c.writePDU(b)
if err != nil {
return sent, err
}
sdu = sdu[plen:]

for len(sdu) > 0 {
	plen := len(sdu)
	if plen > c.txMTU {
		plen = c.txMTU
	}
	n, err := c.writePDU(sdu[:plen])
	sent += n
	if err != nil {
		return sent, err
	}
	sdu = sdu[plen:]
}
return sent, nil

}`

in conn.go Write function,when len(sdu) > c.txMTU ,function is return
What is the meaning of the following fragments?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions