Skip to content
This repository has been archived by the owner on Jun 13, 2019. It is now read-only.

Adding an empty server to the network prevents discovery of resources on other servers #34

Closed
gabrielschulhof opened this issue Nov 13, 2015 · 5 comments
Assignees
Labels

Comments

@gabrielschulhof
Copy link

  1. Write a client that does a discovery every two seconds:

    var device = require( "./index" )();
    
    function throwError( error ) {
        throw error;
    }
    
    function resourceFound( resource ) {
        console.log( "resourceFound: " + JSON.stringify( resource, null, 4 ) );
    }
    
    function repeatedDiscovery() {
        device.client.addEventListener( "resourcefound", resourceFound );
        setInterval( function() {
            console.log( "Calling findResources()" );
            device.client.findResources().catch( throwError );
        }, 2000 );
    }
    
    device.configure( {
        role: "client",
        connectionMode: "acked"
    } ).then( repeatedDiscovery, throwError );
  2. Run node js/server.discoverable.js and observe as the client repeatedly discovers the server

  3. Write an empty server and run it:

    var device = require( "./index" )();
    
    device.configure( {
        role: "server",
        connectionMode: "acked"
    } );
  4. Watch the output of the client

Expected: The client keeps discovering the one resource presented by js/server.discoverable.js

Actual: No resources are discovered until you kill the empty server

@gabrielschulhof
Copy link
Author

@poussa @nagineni @zolkis @siovene this is fixed in iotivity master.

@gabrielschulhof
Copy link
Author

I've asked iotivity-dev whether it might be possible to get this fix out in a 1.0.x release.

@gabrielschulhof
Copy link
Author

OK, so I realized that I wasn't handling the result value from the iotivity OCDoResult response correctly. @nagineni could you please verify that this fixes the discovery breakage for your use case?

@gabrielschulhof
Copy link
Author

... and by "this", I mean branch 34-handle-no-resource-response :)

@nagineni
Copy link

@gabrielschulhof, thanks for the fix. I quickly checked and the discovery works fine with this change.

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

No branches or pull requests

2 participants