fix: more state bugs

This commit is contained in:
0x1a8510f2 2023-04-16 09:26:09 +01:00
parent dce4dffa0f
commit 0675d481a4
Signed by: 0x1a8510f2
GPG Key ID: 1C692E355D76775D

View File

@ -37,15 +37,17 @@ type clientList struct {
func (l *clientList) Append(id string, c client) {
c.prev, c.next = nil, nil
if _, exists := l.clients[id]; !exists {
if l.head == nil {
l.head = &c
}
if l.tail != nil {
l.tail.next = &c
c.prev = l.tail
}
l.tail = &c
}
l.clients[id] = &c
if l.head == nil {
l.head = &c
}
if l.tail != nil {
l.tail.next = &c
c.prev = l.tail
}
l.tail = &c
}
func (l *clientList) Delete(id string) {