Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change .torController (in OnionManager) to be variable instead of static (let) #158

Merged
merged 1 commit into from Feb 4, 2019

Conversation

mtigas
Copy link
Member

@mtigas mtigas commented Feb 3, 2019

re: the control port not receiving data after a restart

I'm making this a pull request because I did this quite quickly and I'm not sure if I've introduced any errors. (In particular, I was just guessing where to use self.torController!.foo... in places where the variable should be set, and then allowing self.torController?.foo... in places where something might be calling the method in an odd place and where maybe it shouldn't be a critical error?)

commit msg

change .torController (in OnionManager) to be variable (maybe nil) instead of static TorController.

testing this out because when tor restarts (after a torStop / torStart -- for example, when backgrounding the app and then coming back), i think the previous TorController's connection is hanging open instead of opening a connection to the new tor that is launched via torStart. (it's a theory, anyway)

sketched out some test output here, in which i think i'm seeing the "control port gets no more output from tor after a restart" issue fixed:
https://gist.github.com/mtigas/439ad3ec84c83d0ab2cdb16e837eac52

…stead of static TorController.

testing this out because when tor restarts (after a torStop / torStart -- for example, when backgrounding the app and then coming back), i think the previous TorController's connection is hanging open instead of opening a connection to the new tor that is launched via torStart. (it's a theory, anyway)
@tladesignz
Copy link
Contributor

It's very strange. I have mixed results.
Most times, this doesn't help. Sometimes, it works the first time, sometimes it works as long as the first page isn't completely loaded.

There seems to be something, which happens during compile time, which influences this. (I inlined Tor.framework for testing, so that and Tor gets recompiled, when I clean the build folder.)
Or even a runtime thing.

Anyway, I'm merging this, as I think it's generally a good idea, and it definitely never worked before, so that's a slight improvement.

Regarding Swift wording, jfyi:

class Foo {
    // static (or better: constant)
    static let x1 = "x"

    // immutable (only available on an object)
    let x2 = "x"

    // mutable
    var x3 = "x"

    // mutable, optional (may be nil)
    var x4: String? = "x"

    // immutable, optional
    let x5: String?

    init(_ bar: Bar) {
        x5 = bar.resultForX5()
    }
}

@tladesignz tladesignz merged commit 7932970 into OnionBrowser:2.X Feb 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants