Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Is there any timeout operation when browse()? #7

Closed
smallzhan opened this issue Jul 22, 2016 · 2 comments
Closed

Is there any timeout operation when browse()? #7

smallzhan opened this issue Jul 22, 2016 · 2 comments

Comments

@smallzhan
Copy link

I did my bonjour search with

rxDnssd.browse("_easylink._tcp.", "local.")
            .takeUntil(Observable.timer(5, TimeUnit.SECONDS))
            .compose(rxDnssd.resolve())
            .compose(rxDnssd.queryRecords())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(...);

And I expect that the onCompleted' of rxDnssd emitted after 5 seconds, but the result is wired. If there are nothing found during browse, i.e, no onNext(...) emitted, theonCompleted' is emitted after 5 seconds, but if there are any 'onNext' emitted during the 5 seconds, There is no `onCompleted'.

@smallzhan
Copy link
Author

smallzhan commented Jul 23, 2016

I ’ve tested the code segment in Version 0.7.1, it works smoothly. Fails in 0.8.0 and 0.8.1.

@andriydruk
Copy link
Owner

andriydruk commented Aug 11, 2016

Hi, I investigated this issue, and I think library works correctly.
Since version 0.8.0 rxDnssd.resolve() became endless operation, that's why queryRecords never sent onComplete (because flatMap usually send onComplete only if all children are completed).

I guess right version should be:

rxDnssd.browse("_easylink._tcp", "local.")
                .compose(rxDnssd.resolve())
                .compose(rxDnssd.queryRecords())
                .takeUntil(Observable.timer(5, TimeUnit.SECONDS))
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(...);

If you will put takeUntil after all flatMaps it would work correctly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants