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

Qt: Add network port input box to GUI settings #7107

Closed
wants to merge 8 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@hsjoberg
Contributor

hsjoberg commented Nov 26, 2015

Related issue #7039

@tulip0

This comment has been minimized.

Show comment
Hide comment
@tulip0

tulip0 Nov 27, 2015

It's counterintuitive to most people that Bitcoin Core will refuse to use non-standard ports as anything but a last resort, does the option label need a GUI label or a confirmation popup to reflect this? I suspect a lot of people will be mystified otherwise that they don't get any incoming connections after changing a fairly innocuous looking option.

tulip0 commented Nov 27, 2015

It's counterintuitive to most people that Bitcoin Core will refuse to use non-standard ports as anything but a last resort, does the option label need a GUI label or a confirmation popup to reflect this? I suspect a lot of people will be mystified otherwise that they don't get any incoming connections after changing a fairly innocuous looking option.

@jonasschnelli jonasschnelli added the GUI label Nov 27, 2015

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Nov 27, 2015

Member

Concept ACK.

We just need to make sure, people can only enter reasonable/valid ports. Because if someone enters port 80, bitcoin-qt is very likely "bricked" (unless he start with root permissions!) until he manages to startup Bitcoin-Qt with a override port setting (through a shell with `-port=8333' or by changing bitcoin.conf).

Best would be to ask the user – during startup – if he likes to switch to the standard port if the given port can't be used (permissions or already used through another process).

Member

jonasschnelli commented Nov 27, 2015

Concept ACK.

We just need to make sure, people can only enter reasonable/valid ports. Because if someone enters port 80, bitcoin-qt is very likely "bricked" (unless he start with root permissions!) until he manages to startup Bitcoin-Qt with a override port setting (through a shell with `-port=8333' or by changing bitcoin.conf).

Best would be to ask the user – during startup – if he likes to switch to the standard port if the given port can't be used (permissions or already used through another process).

@laanwj laanwj added the Feature label Nov 27, 2015

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@hsjoberg

This comment has been minimized.

Show comment
Hide comment
@hsjoberg

hsjoberg Nov 28, 2015

Contributor

Thanks for the feedback @jonasschnelli, I'll work on the things you pointed out.
I'll be available more and more in #bitcoin #bitcoin-dev etc as cocoBTC.

Contributor

hsjoberg commented Nov 28, 2015

Thanks for the feedback @jonasschnelli, I'll work on the things you pointed out.
I'll be available more and more in #bitcoin #bitcoin-dev etc as cocoBTC.

@fanquake

This comment has been minimized.

Show comment
Hide comment
@fanquake

fanquake Dec 24, 2015

Member

@Cocosoft Are you still working on this?

Member

fanquake commented Dec 24, 2015

@Cocosoft Are you still working on this?

@hsjoberg

This comment has been minimized.

Show comment
Hide comment
@hsjoberg

hsjoberg Dec 26, 2015

Contributor

@fanquake Yes, I do intend to continue working on this.

Contributor

hsjoberg commented Dec 26, 2015

@fanquake Yes, I do intend to continue working on this.

@tulip0

This comment has been minimized.

Show comment
Hide comment
@tulip0

tulip0 Dec 26, 2015

Again, this needs a warning that users will get essentially no incoming connections if they change the port. It's not initiative behaviour and will cause significant confusion, I'm not convinced that this option should even be in a configuration window like this to begin with.

 // do not allow non-default ports, unless after 50 invalid addresses selected already
if (addr.GetPort() != Params().GetDefaultPort() && nTries < 50)
    continue;

The address rumouring system really can't be used in conjunction with anything but a single static port.

tulip0 commented Dec 26, 2015

Again, this needs a warning that users will get essentially no incoming connections if they change the port. It's not initiative behaviour and will cause significant confusion, I'm not convinced that this option should even be in a configuration window like this to begin with.

 // do not allow non-default ports, unless after 50 invalid addresses selected already
if (addr.GetPort() != Params().GetDefaultPort() && nTries < 50)
    continue;

The address rumouring system really can't be used in conjunction with anything but a single static port.

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Jan 28, 2016

Member

Concept ACK.

Agree that adding a warning (e.g. as mouseover) would make sense, and that ports should be restricted to valid ports (>1024 at least).

Member

laanwj commented Jan 28, 2016

Concept ACK.

Agree that adding a warning (e.g. as mouseover) would make sense, and that ports should be restricted to valid ports (>1024 at least).

@hsjoberg

This comment has been minimized.

Show comment
Hide comment
@hsjoberg

hsjoberg Jan 28, 2016

Contributor

Just FYI, I am still committed to this issue. I am still alive.

@laanwj, agreed.

Contributor

hsjoberg commented Jan 28, 2016

Just FYI, I am still committed to this issue. I am still alive.

@laanwj, agreed.

@luke-jr

This comment has been minimized.

Show comment
Hide comment
@luke-jr

luke-jr Feb 12, 2016

Member

@Cocosoft I've addressed the port number concern, and modified NetworkStyle to store regtest settings separately from testnet.

git pull https://github.com/luke-jr/bitcoin.git qtnetworkport
Member

luke-jr commented Feb 12, 2016

@Cocosoft I've addressed the port number concern, and modified NetworkStyle to store regtest settings separately from testnet.

git pull https://github.com/luke-jr/bitcoin.git qtnetworkport
@hsjoberg

This comment has been minimized.

Show comment
Hide comment
@hsjoberg

hsjoberg Feb 18, 2016

Contributor

@luke-jr, great, thank you for your help!

Contributor

hsjoberg commented Feb 18, 2016

@luke-jr, great, thank you for your help!

if (settings.value("nNetworkPort") != value) {
// If the port input box is empty, set to default port
if (value.toString().isEmpty()) {
settings.setValue("nNetworkPort", (quint16)Params().GetDefaultPort());

This comment has been minimized.

@hsjoberg

hsjoberg Feb 18, 2016

Contributor

Maybe I'm mistaken, but won't this code never be reached because of acc8f4e?

@hsjoberg

hsjoberg Feb 18, 2016

Contributor

Maybe I'm mistaken, but won't this code never be reached because of acc8f4e?

This comment has been minimized.

@luke-jr

luke-jr Apr 5, 2016

Member

You mean because the empty field is invalid input? I suppose so.

@luke-jr

luke-jr Apr 5, 2016

Member

You mean because the empty field is invalid input? I suppose so.

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Feb 19, 2016

Member

Needs rebase.
I could continue this. I think it needs some additional "focus-lost" checks (also see how proxy port settings do work) and I could imaging a problem when setting the port to a port-number that is already in use (could prevent from starting Bitcoin-Qt).

Member

jonasschnelli commented Feb 19, 2016

Needs rebase.
I could continue this. I think it needs some additional "focus-lost" checks (also see how proxy port settings do work) and I could imaging a problem when setting the port to a port-number that is already in use (could prevent from starting Bitcoin-Qt).

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Apr 5, 2016

Member

@ping Cocosoft. Are you interested to finish this?

Member

jonasschnelli commented Apr 5, 2016

@ping Cocosoft. Are you interested to finish this?

@hsjoberg

This comment has been minimized.

Show comment
Hide comment
@hsjoberg

hsjoberg Apr 5, 2016

Contributor

@jonasschnelli, I am interested in finishing this. I do understand however if you or someone else wants to take over because it has been idling for so long.

I'll try to be on the IRC channel this week.

Contributor

hsjoberg commented Apr 5, 2016

@jonasschnelli, I am interested in finishing this. I do understand however if you or someone else wants to take over because it has been idling for so long.

I'll try to be on the IRC channel this week.

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Apr 25, 2016

Member

I could imaging a problem when setting the port to a port-number that is already in use (could prevent from starting Bitcoin-Qt).

Possibly in the case of the GUI it could be non-fatal if binding a port at startup fails. After warning the user there's no harm in continuing with the port closed.

This would make this change a lot less dangerous.

Member

laanwj commented Apr 25, 2016

I could imaging a problem when setting the port to a port-number that is already in use (could prevent from starting Bitcoin-Qt).

Possibly in the case of the GUI it could be non-fatal if binding a port at startup fails. After warning the user there's no harm in continuing with the port closed.

This would make this change a lot less dangerous.

@fanquake

This comment has been minimized.

Show comment
Hide comment
@fanquake

fanquake Jun 22, 2016

Member

@Cocosoft Are you still planning on finishing this? This needs a rebase at least.

Member

fanquake commented Jun 22, 2016

@Cocosoft Are you still planning on finishing this? This needs a rebase at least.

@hsjoberg

This comment has been minimized.

Show comment
Hide comment
@hsjoberg

hsjoberg Jun 22, 2016

Contributor

@fanquake Yes, I haven't forgotten about this and I still plan to continue, I just need to find time. I fully understand if someone wants to finish it up though, as it has been delayed for so long.

Contributor

hsjoberg commented Jun 22, 2016

@fanquake Yes, I haven't forgotten about this and I still plan to continue, I just need to find time. I fully understand if someone wants to finish it up though, as it has been delayed for so long.

@luke-jr

This comment has been minimized.

Show comment
Hide comment
@luke-jr

luke-jr Jun 27, 2016

Member

Why did you add an enableOkButton and disableOkButton methods that are unused?

Member

luke-jr commented Jun 27, 2016

Why did you add an enableOkButton and disableOkButton methods that are unused?

@hsjoberg

This comment has been minimized.

Show comment
Hide comment
@hsjoberg

hsjoberg Jun 27, 2016

Contributor

I did not, actually you made them according to Git:

$ git blame -L 227,227 src/qt/optionsdialog.cpp
578064a6 (Luke Dashjr 2016-02-12 20:08:00 +0000 227) void OptionsDialog::enableOkButton()

I'll rebase again and fix that.

Or did you merge the qtnetworkport branch to the master branch of Bitcoinknots? If that's the case, I maybe could just make a new commit removed the unused code.

Contributor

hsjoberg commented Jun 27, 2016

I did not, actually you made them according to Git:

$ git blame -L 227,227 src/qt/optionsdialog.cpp
578064a6 (Luke Dashjr 2016-02-12 20:08:00 +0000 227) void OptionsDialog::enableOkButton()

I'll rebase again and fix that.

Or did you merge the qtnetworkport branch to the master branch of Bitcoinknots? If that's the case, I maybe could just make a new commit removed the unused code.

@luke-jr

This comment has been minimized.

Show comment
Hide comment
@luke-jr

luke-jr Jun 27, 2016

Member

That code wasn't part of my commit; somehow it got added in when you rebased. Perhaps an accident during a merge?

Member

luke-jr commented Jun 27, 2016

That code wasn't part of my commit; somehow it got added in when you rebased. Perhaps an accident during a merge?

@hsjoberg

This comment has been minimized.

Show comment
Hide comment
@hsjoberg

hsjoberg Jun 27, 2016

Contributor

You're right, sorry. It seems like Philip Kaufman wrote the functions back in 2013:

$ git blame -L 227,227 src/qt/optionsdialog.cpp
7e195e84 (Philip Kaufmann 2013-12-03 09:10:10 +0100 227)     setOkButtonState(false);
Contributor

hsjoberg commented Jun 27, 2016

You're right, sorry. It seems like Philip Kaufman wrote the functions back in 2013:

$ git blame -L 227,227 src/qt/optionsdialog.cpp
7e195e84 (Philip Kaufmann 2013-12-03 09:10:10 +0100 227)     setOkButtonState(false);
@hsjoberg

This comment has been minimized.

Show comment
Hide comment
@hsjoberg

hsjoberg Jun 27, 2016

Contributor

I'm not sure where the functions come from, I can confirm (by a backup) that they existed before the rebase I did.

I'll remove them.

Edit: Right, I had a merge conflict regarding the functions during the rebase. My bad!

Contributor

hsjoberg commented Jun 27, 2016

I'm not sure where the functions come from, I can confirm (by a backup) that they existed before the rebase I did.

I'll remove them.

Edit: Right, I had a merge conflict regarding the functions during the rebase. My bad!

luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Jun 28, 2016

@fanquake

This comment has been minimized.

Show comment
Hide comment
@fanquake

fanquake Aug 31, 2016

Member

This needs a rebase.

Member

fanquake commented Aug 31, 2016

This needs a rebase.

hsjoberg and others added some commits Nov 26, 2015

Qt/Options: Adding network port to GUI settings, fixes #7039
Adds Network port input box to the Network tab in the Options dialog.
-port takes priority over the GUI setting.
If left blank, it will default to the default port
Adding functions SetArg and SetBoolArg to util.cpp
Lets you override an argument even if it has already been set,
in contrast to SoftSetArg/SoftSetBoolArg.
Qt: Ask user to use standard port on startup if specified port is in use
If the port (specified by -port or GUI setting) is already in use when
starting the GUI client, and it's not the standard port, ask the user if
they want to listen via the standard network port instead.
@hsjoberg

This comment has been minimized.

Show comment
Hide comment
@hsjoberg

hsjoberg Sep 5, 2016

Contributor

As per @jonasschnelli suggestion, I added a Question box on startup to ask if the user wants to use the standard network port if the specified port (whether it's from -port or in GUI) is already in use.

Contributor

hsjoberg commented Sep 5, 2016

As per @jonasschnelli suggestion, I added a Question box on startup to ask if the user wants to use the standard network port if the specified port (whether it's from -port or in GUI) is already in use.

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Sep 20, 2016

Member

Needs rebase and nit fixes.

Member

jonasschnelli commented Sep 20, 2016

Needs rebase and nit fixes.

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Oct 18, 2016

Member

Closing due to inactivity. Happy to reopen once this has made progress.

Member

jonasschnelli commented Oct 18, 2016

Closing due to inactivity. Happy to reopen once this has made progress.

luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016

Adding functions SetArg and SetBoolArg to util.cpp
Lets you override an argument even if it has already been set,
in contrast to SoftSetArg/SoftSetBoolArg.

Github-Pull: bitcoin#7107
Rebased-From: f5267bf

luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Oct 20, 2016

Qt: Ask user to use standard port on startup if specified port is in use
If the port (specified by -port or GUI setting) is already in use when
starting the GUI client, and it's not the standard port, ask the user if
they want to listen via the standard network port instead.

Github-Pull: bitcoin#7107
Rebased-From: 1f37c87

luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Feb 18, 2017

Adding functions SetArg and SetBoolArg to util.cpp
Lets you override an argument even if it has already been set,
in contrast to SoftSetArg/SoftSetBoolArg.

Github-Pull: bitcoin#7107
Rebased-From: f5267bf

luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Feb 18, 2017

Qt: Ask user to use standard port on startup if specified port is in use
If the port (specified by -port or GUI setting) is already in use when
starting the GUI client, and it's not the standard port, ask the user if
they want to listen via the standard network port instead.

Github-Pull: bitcoin#7107
Rebased-From: 1f37c87
@hsjoberg

This comment has been minimized.

Show comment
Hide comment
@hsjoberg

hsjoberg Feb 23, 2017

Contributor

Hi @jonasschnelli, I've rebased the branch upon master on cocosoft/bitcoin branch qtnetworkport.
I'm not sure what nits are still missing, but I would be happy to fix them.

I added a warning prompt on startup if the user tries to use a non-standard port that is already in use, and gives the option to use the standard port.

Best
Hampus

Contributor

hsjoberg commented Feb 23, 2017

Hi @jonasschnelli, I've rebased the branch upon master on cocosoft/bitcoin branch qtnetworkport.
I'm not sure what nits are still missing, but I would be happy to fix them.

I added a warning prompt on startup if the user tries to use a non-standard port that is already in use, and gives the option to use the standard port.

Best
Hampus

luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Aug 27, 2017

Qt: Ask user to use standard port on startup if specified port is in use
If the port (specified by -port or GUI setting) is already in use when
starting the GUI client, and it's not the standard port, ask the user if
they want to listen via the standard network port instead.

Github-Pull: bitcoin#7107
Rebased-From: 1f37c87

luke-jr added a commit to luke-jr/bitcoin that referenced this pull request Aug 29, 2017

Qt: Ask user to use standard port on startup if specified port is in use
If the port (specified by -port or GUI setting) is already in use when
starting the GUI client, and it's not the standard port, ask the user if
they want to listen via the standard network port instead.

Github-Pull: bitcoin#7107
Rebased-From: 1f37c87

luke-jr added a commit to bitcoinknots/bitcoin that referenced this pull request Mar 13, 2018

Qt: Ask user to use standard port on startup if specified port is in use
If the port (specified by -port or GUI setting) is already in use when
starting the GUI client, and it's not the standard port, ask the user if
they want to listen via the standard network port instead.

Github-Pull: bitcoin#7107
Rebased-From: 1f37c87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment