Skip to content

Commit c9d4987

Browse files
xibzmoogle19
authored andcommitted
Fixes OSX unsupported key for MTU (#30)
1 parent 731710e commit c9d4987

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

darwin/msg.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ func (m msg) args() xpc.Dict { return xpc.Dict(m).MustGetDict("kCBMsgArgs") }
1212
func (m msg) advertisementData() xpc.Dict {
1313
return xpc.Dict(m).MustGetDict("kCBMsgArgAdvertisementData")
1414
}
15-
func (m msg) attMTU() int { return xpc.Dict(m).MustGetInt("kCBMsgArgATTMTU") }
15+
16+
const macOSXDefaultMTU = 23
17+
18+
// Uses GetInt as oppose to MustGetInt due to OSX not supporting 'kCBMsgArgATTMTU'.
19+
// Issue #29
20+
func (m msg) attMTU() int { return xpc.Dict(m).GetInt("kCBMsgArgATTMTU", macOSXDefaultMTU) }
1621
func (m msg) attWrites() xpc.Array { return xpc.Dict(m).MustGetArray("kCBMsgArgATTWrites") }
1722
func (m msg) attributeID() int { return xpc.Dict(m).MustGetInt("kCBMsgArgAttributeID") }
1823
func (m msg) characteristicHandle() int {

0 commit comments

Comments
 (0)