|
|
@ -92,8 +92,9 @@ func (ch *CaddyHugo) handleConn(conn DeltaConn, doc *docref) (int, error) { |
|
|
|
wroteMessagesCh := make(chan Message, 2) |
|
|
|
wroteMessagesCh := make(chan Message, 2) |
|
|
|
|
|
|
|
|
|
|
|
client := doc.doc.Client(acedoc.DeltaHandlerFunc(func(ds []acedoc.Delta) error { |
|
|
|
client := doc.doc.Client(acedoc.DeltaHandlerFunc(func(ds []acedoc.Delta) error { |
|
|
|
wroteMessagesCh <- Message{Deltas: ds} |
|
|
|
m := ch.Message(ds...) |
|
|
|
return conn.WriteJSON(ch.Message(ds...)) |
|
|
|
wroteMessagesCh <- m |
|
|
|
|
|
|
|
return conn.WriteJSON(m) |
|
|
|
})) |
|
|
|
})) |
|
|
|
|
|
|
|
|
|
|
|
ch.mtx.Lock() |
|
|
|
ch.mtx.Lock() |
|
|
@ -119,6 +120,11 @@ func (ch *CaddyHugo) handleConn(conn DeltaConn, doc *docref) (int, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
ch.ObserveLTime(message.LTime) |
|
|
|
ch.ObserveLTime(message.LTime) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(message.Deltas) == 0 { |
|
|
|
|
|
|
|
time.Sleep(10 * time.Microsecond) |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
err = client.PushDeltas(message.Deltas...) |
|
|
|
err = client.PushDeltas(message.Deltas...) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
errCh <- err |
|
|
|
errCh <- err |
|
|
|