[ 
https://issues.apache.org/jira/browse/THRIFT-2654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14151206#comment-14151206
 ] 

Jens Geyer commented on THRIFT-2654:
------------------------------------

I like the idea. But Peek() isn't actually a peek, it is a read operation. 
Let's just take this (theoretical) scenario:

 * call  transport.Peek()  to effectively read a Byte
 * now call  transport.Read()  instead of  transport.ReadAll()  
 * depending on the Transport used, you may lose the peeked Byte, maybe read it 
later out of band.

I haven't checked the entire code if that is currently the case, but I don't 
like even the possibility of this. To me it would unexpected that Read and 
ReadAll differ that much. 

While we're at it, why don't we implement a real peek operation? Again, I like 
the idea!

https://github.com/apache/thrift/pull/177#issuecomment-56222777


> reduce number of server exceptions
> ----------------------------------
>
>                 Key: THRIFT-2654
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2654
>             Project: Thrift
>          Issue Type: Improvement
>          Components: C# - Library
>            Reporter: Jens Geyer
>
> GitHub user captncraig opened a pull request:
>     https://github.com/apache/thrift/pull/177
>     C# - reduce number of server exceptions
>     The current server implementation reads in a loop until the client 
> closes, at which point an exception is thrown by the processor/transport and 
> caught by the server.
>     
>     I solve this by creating a smarter peek functionality in TTransport which 
> reads and caches a byte from the underlying transport and reinserts it in 
> ReadAll.  
> You can merge this pull request into a Git repository by running:
>     $ git pull https://github.com/captncraig/thrift transport-peek
> Alternatively you can review and apply these changes as the patch at:
>     https://github.com/apache/thrift/pull/177.patch
> To close this pull request, make a commit to your master/trunk branch
> with (at least) the following in the commit message:
>     This closes #177



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to