Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

thaliMobile needs clean up native Android peer listeners when it declares a peer unavailable #1454 #1831

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

opetkevich
Copy link
Contributor

@opetkevich opetkevich commented Mar 16, 2017

This change is Reviewable

@ThaliTester
Copy link
Member

Test 111073062 (a55528a) build started.

@ThaliTester
Copy link
Member

PR is added to the queue for testing as 1. task. (a55528a)

@chapko chapko assigned opetkevich and unassigned chapko Mar 16, 2017
@chapko
Copy link
Contributor

chapko commented Mar 16, 2017

-@chapko +@opetkevich


Reviewed 3 of 3 files at r1.
Review status: all files reviewed at latest revision, 3 unresolved discussions.


test/www/jxcore/bv_tests/testThaliMobile.js, line 2235 at r1 (raw file):

      ThaliMobile.stop().then(function () {
        t.equal(nativeDisconnectSpy.callCount, 1,
          'native wrapper `disconnect` called');

This test tests that after calling ThaliMobile.stop() it calls disconnect on the discovered peer.

There also should be a test, that tests disconnect call after receiving 'peer is not available' event.

Also I would add additional check for correct arguments (spy.calledWithExactly).


thali/NextGeneration/thaliMobile.js, line 1258 at r1 (raw file):

function changeCachedPeerUnavailable (peer) {
  removeAvailabilityWatcherFromPeerIfExists(peer);
  _this.disconnect(peer.peerIdentifier, peer.portNumber);

We usually use module.exports to access exported variables. Please, change it to module.exports.disconnect(...) for consistency.


thali/NextGeneration/thaliMobileNativeWrapper.js, line 814 at r1 (raw file):

  }
  return gPromiseQueue.enqueue(function (resolve, reject) {
    if(gServersManager !== null) {

NB: It probably would be more readable to use early return here.

if (!gServersManager) {
  return resolve();
}
...

Comments from Reviewable

@ThaliTester
Copy link
Member

PR is added to the queue for testing as 1. task. (99e67f9)

@ThaliTester
Copy link
Member

Test 111073062 (99e67f9) build started.

@opetkevich opetkevich assigned chapko and unassigned opetkevich Mar 17, 2017
@thaliproject thaliproject deleted a comment from msftclas Sep 27, 2017
@chapko chapko removed their request for review December 19, 2019 09:37
@chapko chapko removed their assignment Dec 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants