websocket: Oops, avoid looping.
authorJan Nieuwenhuizen <janneke@gnu.org>
Tue, 28 Jan 2020 13:08:29 +0000 (14:08 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Tue, 28 Jan 2020 13:11:38 +0000 (14:11 +0100)
* 8sync/systems/websocket/server.scm (websocket-client-loop): Oops,
avoid looping.

8sync/systems/websocket/server.scm

index af0fe1fb5b88af205c7c53d825f6e65e91e42679..c29ce51e44c40c545219f258daad01dee5207631 100644 (file)
@@ -157,11 +157,12 @@ called for each complete message that is received."
           (loop fragments type))
          ((first-fragment-frame? frame) ; begin accumulating fragments
           (loop (list frame) (frame-type frame)))
-         ((fragment-frame? frame) ; add a fragment
-          (loop (cons frame fragments) type))
          ((final-fragment-frame? frame) ; concatenate all fragments
-          (handle-data-frame type (frame-concatenate (reverse fragments)))
+          (handle-data-frame type (frame-concatenate
+                                   (reverse (cons frame fragments))))
           (loop '() #f))
+         ((fragment-frame? frame) ; add a fragment
+          (loop (cons frame fragments) type))
          ((data-frame? frame) ; unfragmented data frame
           (handle-data-frame (frame-type frame) (frame-data frame))
           (loop '() #f)))))))