Skip to content

Commit

Permalink
Merge branch 'master' into dirsync-async
Browse files Browse the repository at this point in the history
  • Loading branch information
t2y authored Aug 20, 2023
2 parents 6fad509 + 7f97b82 commit 579443a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions v3/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -945,9 +945,12 @@ func (c *ControlSyncRequest) GetControlType() string {
func (c *ControlSyncRequest) Encode() *ber.Packet {
_mode := int64(c.Mode)
mode := ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagEnumerated, _mode, "Mode")
cookie := ber.Encode(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, nil, "Cookie")
cookie.Value = c.Cookie
cookie.Data.Write(c.Cookie)
var cookie *ber.Packet
if len(c.Cookie) > 0 {
cookie = ber.Encode(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, nil, "Cookie")
cookie.Value = c.Cookie
cookie.Data.Write(c.Cookie)
}
reloadHint := ber.NewBoolean(ber.ClassUniversal, ber.TypePrimitive, ber.TagBoolean, c.ReloadHint, "Reload Hint")

packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Control")
Expand All @@ -957,7 +960,9 @@ func (c *ControlSyncRequest) Encode() *ber.Packet {
val := ber.Encode(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, nil, "Control Value (Sync Request)")
seq := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Sync Request Value")
seq.AppendChild(mode)
seq.AppendChild(cookie)
if cookie != nil {
seq.AppendChild(cookie)
}
seq.AppendChild(reloadHint)
val.AppendChild(seq)

Expand Down

0 comments on commit 579443a

Please sign in to comment.