[BUG][FIX][FIX], was: (Re: Re: Flaw in SocketStream>>peek detected)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[BUG][FIX][FIX], was: (Re: Re: Flaw in SocketStream>>peek detected)

Igor Stasenko
My first attempt to fix it was also flawed. Thanks to Stephan for
pointing it out. (You can read our discussion here:
http://code.google.com/p/pharo/issues/detail?id=1813)


I hope this time its fixing it! :)


--
Best regards,
Igor Stasenko AKA sig.



socketstream-fix2.1.cs (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [BUG][FIX][FIX], was: (Re: Re: Flaw in SocketStream>>peek detected)

Andreas.Raab
Igor Stasenko wrote:
> My first attempt to fix it was also flawed. Thanks to Stephan for
> pointing it out. (You can read our discussion here:
> http://code.google.com/p/pharo/issues/detail?id=1813)
>
>
> I hope this time its fixing it! :)

 From what I can tell, the changes are completely equivalent. Could you
please write a test that illustrates what you think was wrong with the
previous version? Attached are some tests that (I think) show that
there's really no difference in these versions.

Cheers,
   - Andreas



SocketStreamTest.st (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: [BUG][FIX][FIX], was: (Re: Re: Flaw in SocketStream>>peek detected)

Igor Stasenko
2010/1/15 Andreas Raab <[hidden email]>:

> Igor Stasenko wrote:
>>
>> My first attempt to fix it was also flawed. Thanks to Stephan for
>> pointing it out. (You can read our discussion here:
>> http://code.google.com/p/pharo/issues/detail?id=1813)
>>
>>
>> I hope this time its fixing it! :)
>
> From what I can tell, the changes are completely equivalent. Could you
> please write a test that illustrates what you think was wrong with the
> previous version? Attached are some tests that (I think) show that there's
> really no difference in these versions.
>

| s|
s:= (SocketStream openConnectionToHostNamed:  'google.com' port: 80) .
s shouldSignal: true.
s peek

" the above should endup with timeout exception ,
but following one should hang indefinitely"

| s|
s:= (SocketStream openConnectionToHostNamed:  'google.com' port: 80) .
s shouldSignal: false.
s peek

same for the #next.

> Cheers,
>  - Andreas
>

--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: [BUG][FIX][FIX], was: (Re: Re: Flaw in SocketStream>>peek detected)

Andreas.Raab
Igor Stasenko wrote:
> " the above should endup with timeout exception ,
> but following one should hang indefinitely"

Absolutely not. Read the comment on shouldSignal:

        "If shouldSignal is enabled the Socket Exceptions
        ConnectionClosed and ConnectionTimedOut"

#shouldSignal does NOT cover timeouts; timeouts are set separately, via
#timeout:. If you want peek to wait forever you need to use, e.g.,

| s|
s:= (SocketStream openConnectionToHostNamed:  'google.com' port: 80) .
s timeout: 0. "<- no timeouts please"
s peek.


Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: [BUG][FIX][FIX], was: (Re: Re: Flaw in SocketStream>>peek detected)

Andreas.Raab
Andreas Raab wrote:
> Igor Stasenko wrote:
>> " the above should endup with timeout exception ,
>> but following one should hang indefinitely"
>
> Absolutely not. Read the comment on shouldSignal:
>
>     "If shouldSignal is enabled the Socket Exceptions
>     ConnectionClosed and ConnectionTimedOut"

And I guess I should read more carefully, too :-) In any case, timeouts
*are* handled via #timeout: and that makes good sense.

   - A.

>
> #shouldSignal does NOT cover timeouts; timeouts are set separately, via
> #timeout:. If you want peek to wait forever you need to use, e.g.,
>
> | s|
> s:= (SocketStream openConnectionToHostNamed:  'google.com' port: 80) .
> s timeout: 0. "<- no timeouts please"
> s peek.
>
>
> Cheers,
>   - Andreas
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [BUG][FIX][FIX], was: (Re: Re: Flaw in SocketStream>>peek detected)

Andreas.Raab
Andreas Raab wrote:

> Andreas Raab wrote:
>> Igor Stasenko wrote:
>>> " the above should endup with timeout exception ,
>>> but following one should hang indefinitely"
>>
>> Absolutely not. Read the comment on shouldSignal:
>>
>>     "If shouldSignal is enabled the Socket Exceptions
>>     ConnectionClosed and ConnectionTimedOut"
>
> And I guess I should read more carefully, too :-) In any case, timeouts
> *are* handled via #timeout: and that makes good sense.

(last response to my own post :-)

And of course, the easy to do what you're trying to do is to change:

shouldTimeout
        ^timeout > 0 and:[shouldSignal]

This would suppress all timeouts unless shouldSignal is true. BTW, I've
never seen a case where I've been using a non-signaling socket stream.
Does that case even exist?

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Re: [BUG][FIX][FIX], was: (Re: Re: Flaw in SocketStream>>peek detected)

Igor Stasenko
I am completely & finally confused.
Anyways, a fix which i provided initially doesn't deals with timeouts,
just picks the right byte.
And it works for me. ;)

2010/1/15 Andreas Raab <[hidden email]>:

> Andreas Raab wrote:
>>
>> Andreas Raab wrote:
>>>
>>> Igor Stasenko wrote:
>>>>
>>>> " the above should endup with timeout exception ,
>>>> but following one should hang indefinitely"
>>>
>>> Absolutely not. Read the comment on shouldSignal:
>>>
>>>    "If shouldSignal is enabled the Socket Exceptions
>>>    ConnectionClosed and ConnectionTimedOut"
>>
>> And I guess I should read more carefully, too :-) In any case, timeouts
>> *are* handled via #timeout: and that makes good sense.
>
> (last response to my own post :-)
>
> And of course, the easy to do what you're trying to do is to change:
>
> shouldTimeout
>        ^timeout > 0 and:[shouldSignal]
>
> This would suppress all timeouts unless shouldSignal is true. BTW, I've
> never seen a case where I've been using a non-signaling socket stream. Does
> that case even exist?
>

I guess no.

> Cheers,
>  - Andreas
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: Re: [BUG][FIX][FIX], was: (Re: Re: Flaw in SocketStream>>peek detected)

Göran Krampe
In reply to this post by Andreas.Raab
Hi!

Andreas Raab wrote:
> This would suppress all timeouts unless shouldSignal is true. BTW, I've
> never seen a case where I've been using a non-signaling socket stream.
> Does that case even exist?

Not really, IIRC I enabled that option only in order to be COMPLETELY
backwards compatible with the old SocketStream implementation stemming
from Bolot Kerimbaev.

Using a non signalling SocketStream is IIRC a bit edgy too - I think
there are cases which the code really does not know how to handle.

Btw, anyone know what happened to Bolot?

regards, Göran


Reply | Threaded
Open this post in threaded view
|

Bolot

Yoshiki Ohshima-2
At Fri, 15 Jan 2010 09:32:10 +0100,
Göran Krampe wrote:
>
> Btw, anyone know what happened to Bolot?

  A couple of years ago, I got a chance to correspond with him a bit.
He was still in Atlanta.  (Because of the collapse after that, I can't
tell for sure what he is up to.)

-- Yoshiki

(If you want to get in touch with him, here is a secret way to find
out his email address: follow the google link below:

http://www.google.com/search?rlz=1C1GGLS_jaUS343US343&sourceid=chrome&ie=UTF-8&q=%D0%9A%D0%B5%D1%80%D0%B8%D0%BC%D0%B1%D0%B0%D0%B5%D0%B2+%D0%91%D0%BE%D0%BB%D0%BE%D1%82

look at the first hit and search for his name.)