Skip to content

small cleanup of net#4227

Merged
laanwj merged 2 commits intobitcoin:masterfrom
Diapolo:net_cleanup
Jun 11, 2014
Merged

small cleanup of net#4227
laanwj merged 2 commits intobitcoin:masterfrom
Diapolo:net_cleanup

Conversation

@Diapolo
Copy link
Copy Markdown

@Diapolo Diapolo commented May 24, 2014

1st commit:

  • remove an unneded else in ConnectNode()
  • make 0 a double and change to 0.0 in ConnectNode()
  • rename strDest to pszDest in OpenNetworkConnection()
  • remove an unneded call to our REF() macro in BindListenPort()
  • small style cleanups and removal of unneeded new-lines

2nd commit:

  • convert an if into an else if in OpenNetworkConnection()

Comment thread src/net.cpp Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might as well merge this whole set of ifs into a single one:

if ((!pszDest && (IsLocal(addrConnect) ||
      FindNode((CNetAddr)addrConnect) || CNode::IsBanned(addrConnect) ||
      FindNode(addrConnect.ToStringIPPort().c_str()))) ||
    (pszDest && FindNode(pszDest))) 
{
    return false;
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not even sure, if anyone is interested in that pull ;).

@brandondahler
Copy link
Copy Markdown
Contributor

Reviewed code, looks good to me other than a nit noted above.

Comment thread src/net.cpp Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either you use:

if condition1 {
  ...
} else if condition2
  ...;

or

if condition1
{
  ...
}
else if condition2
  ...;

... but not a mix of both.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated and thanks for mentioning it.

@Diapolo
Copy link
Copy Markdown
Author

Diapolo commented Jun 5, 2014

@sipa ping

@Diapolo
Copy link
Copy Markdown
Author

Diapolo commented Jun 11, 2014

Is anyone willing to merge this or not?

Comment thread src/net.cpp
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't combine logic changes with style cleanups (although this one is pretty obviously correct)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I create an additional commit for this or another pull?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Splitting it to a seperate commit in this pull is fine! just don't do it in the same commit

@laanwj
Copy link
Copy Markdown
Member

laanwj commented Jun 11, 2014

ACK apart from my nit

Comment thread src/net.cpp Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't remove this initialization. It changes the meaning of the function, so should not be combined with style changes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted this change!

Philip Kaufmann added 2 commits June 11, 2014 12:38
- remove an unneded else in ConnectNode()
- make 0 a double and change to 0.0 in ConnectNode()
- rename strDest to pszDest in OpenNetworkConnection()
- remove an unneded call to our REF() macro in BindListenPort()
- small style cleanups and removal of unneeded new-lines
@BitcoinPullTester
Copy link
Copy Markdown

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/1bf2ab8e9f3eb5ca89536dca5a581004df7dd2dc for binaries and test log.
This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/
Contact BlueMatt on freenode if something looks broken.

@laanwj laanwj merged commit 634bd61 into bitcoin:master Jun 11, 2014
laanwj added a commit that referenced this pull request Jun 11, 2014
634bd61 convert an if into an else if in OpenNetworkConnection() (Philip Kaufmann)
5bd6c31 small cleanup of net (Philip Kaufmann)
@Diapolo Diapolo deleted the net_cleanup branch June 11, 2014 11:28
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
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