Hi Peter,
Sorry I wasn't able to jump in to help in time.
Seems like you have it solved though, thanks for sharing your findings /
snippet.

As for streams we do want to and will provide something that has the
feature you're asking for with akka-streams,
we just haven't gotten the time yet to do it. Stay tuned and look forward
to it's 1.0! :-)

-- konrad

On Wed, Nov 19, 2014 at 3:59 PM, Peter <[email protected]> wrote:

> Nobody wants to touch this one with a 10' pole ? :)
>
> I was able to confirm my theory by sending my service a malformed packet
> (ByteString(0, 0, 0, 0) header). I made this crude modification for now to
> "fix" it:
>
>       @tailrec
>       def extractFrames(bs: ByteString, acc: List[ByteString]) //
>       : (Option[ByteString], Seq[ByteString]) = {
>         if (bs.isEmpty) {
>           (None, acc)
>         } else if (bs.length < headerSize) {
>           (Some(bs.compact), acc)
>         } else {
>           val length = bs.iterator.getLongPart(headerSize).toInt
>           if (length < 0 || length > maxSize)
>             throw new IllegalArgumentException(
>               s"received too large frame of size $length (max = $maxSize)")
> +         if (0 == length)
> +          throw new IllegalArgumentException(
> +             s"received data but the frame header indicates 0 length?
> discarding")
>           val total = if (lengthIncludesHeader) length else length +
> headerSize
>           if (bs.length >= total) {
>             println("slicing from {} to {} currently length {}",
> headerSize, total, bs.length)
>             extractFrames(bs drop total, bs.slice(headerSize, total) ::
> acc)
>           } else {
>             (Some(bs.compact), acc)
>           }
>         }
>       }
>
> Maybe it can help someone else..
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Akka Team
Typesafe - The software stack for applications that scale
Blog: letitcrash.com
Twitter: @akkateam

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to