[erlang-bugs] Bug in the resolver?

Ahmed Omar <>
Tue Apr 12 13:56:26 CEST 2011


Then going back to my original message, the order of case clauses doesn't
sound right
{ok,{IP,Port,Answer}} ->
    {ok,Answer,erlang:max(0, Timeout - now_ms(erlang:now(), Then))};
{ok,_} when Timeout =:= 0 ->
        {error,timeout};


Cause even when the timeout is 0 now, now_ms/2 will be called with Then =
undefined

On Tue, Apr 12, 2011 at 1:51 PM, Raimo Niskanen <
> wrote:

> On Tue, Apr 12, 2011 at 01:35:33PM +0200, Raimo Niskanen wrote:
> > On Tue, Apr 12, 2011 at 01:08:24PM +0200, Ahmed Omar wrote:
> > > Hmmm, the crash doesn't look to be in subtraction (otherwise it would
> have
> > > been badarg?),  it's a crash because of a function clause in now_ms
> (because
> > > undefined won't match)
> > > (and undefined looks to be generated only when timeout is 0 )
> >
> > Well, I ment _conceptually_ subtract since now_ms/2 is supposed to
> > return the number of elapsed microseconds i.e subtract
>
> Milliseconds. Sorry. That should be milliseconds.
>
> > its now() arguments, and now got 'undefined' instead
> > of {MegaSec,Sec,MicroSec) as second argumnent.
> >
> > 'undefined' must be a leftover from an unfinished implementation
> > of either the case when you have timed out or when the
> > timeout is 'infinity'. Nevertheless it is incorrect.
> >
> > The Timeout variable is how long time still remains to wait of the
> > initial user interface timeout.
> >
> > >
> > > Maybe I'm missing something or my coffee doesn't work :)
> > >
> : :
> > > Follow me on twitter
> > > @spawn_think <http://twitter.com/#!/spawn_think>
> >
> > --
> >
> > / Raimo Niskanen, Erlang/OTP, Ericsson AB
> > _______________________________________________
> > erlang-bugs mailing list
> > 
> > http://erlang.org/mailman/listinfo/erlang-bugs
>
> --
>
> / Raimo Niskanen, Erlang/OTP, Ericsson AB
> _______________________________________________
> erlang-bugs mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-bugs
>



-- 
Best Regards,
- Ahmed Omar
http://nl.linkedin.com/in/adiaa
Follow me on twitter
@spawn_think <http://twitter.com/#!/spawn_think>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20110412/70b3f6df/attachment.html>


More information about the erlang-bugs mailing list