Github user ivmaykov commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/679#discussion_r233656579
  
    --- Diff: 
zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/PrependableSocket.java
 ---
    @@ -18,32 +18,47 @@
     
     package org.apache.zookeeper.server.quorum;
     
    -import java.io.ByteArrayInputStream;
     import java.io.IOException;
     import java.io.InputStream;
    -import java.io.SequenceInputStream;
    +import java.io.PushbackInputStream;
     import java.net.Socket;
     import java.net.SocketImpl;
     
     public class PrependableSocket extends Socket {
     
    -  private SequenceInputStream sequenceInputStream;
    +  private PushbackInputStream pushbackInputStream;
    --- End diff --
    
    I don't know why it worked like that, but that is what I observed in tests. 
It looks like SequenceInputStream does not join returned data across boundaries 
of the underlying streams when the first stream gets to EOF. I don't think this 
is desired behavior since it would cause the stream to return 5 bytes when more 
than 5 bytes are actually available.


---

Reply via email to