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 use of NodeItem to AddrPort in node base classes #350

Conversation

gavin-norman-sociomantic

No description provided.

@gavin-norman-sociomantic
Copy link
Author

Note to reviewer: could you confirm the changes around InetAddress and AddrPort? It's quite complicated.

@gavin-norman-sociomantic
Copy link
Author

(I was originally intending to replace all internal usage of NodeItem with AddrPort -- see #348 -- but this is a massive undertaking, as it's used extensively in the client. This PR just updates a small section -- the node bases.)

@gavin-norman-sociomantic
Copy link
Author

Blocked pending testing with proto and node repos.

@@ -38,9 +39,20 @@ public interface INodeInfo

**************************************************************************/

deprecated("Use addr_port instead")
public NodeItem node_item ( );
Copy link
Contributor

Choose a reason for hiding this comment

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

Deprecation node?

Choose a reason for hiding this comment

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

Could you elaborate?


**************************************************************************/

public AddrPort addr_port ( );
Copy link
Contributor

Choose a reason for hiding this comment

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

Breaking change?

@@ -845,13 +891,18 @@ public class NodeBase ( ConnHandler : ISwarmConnectionHandler ) : INodeBase
}

// Super ctor.
InetAddress!(false) addr, neo_addr;
addr = cast(sockaddr_in)node;
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding opCast from AddrPort directly to InetAddr.

super(node, conn_setup_params,
this.listener = new Listener(
addr(node.Address, node.Port), this.socket, conn_setup_params,
cast(sockaddr*)&addr.addr, this.socket, conn_setup_params,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine, considering that addr.addr is sockaddr_in. However, I think by casting pointer we're loosing the type safety here. I would just add the static assert before static assert(typeof(addr.addr) is sockaddr_in).

Gavin Norman added 5 commits August 2, 2018 12:14
As part of replacing internal usages of NodeItem with AddrPort, it's useful
to have a convenient way of converting from one to the other.

Part of sociomantic-tsunami#348.
This tests that all expected base class and interface methods are
implemented, not merely that the code is syntactically correct.
@gavin-norman-sociomantic
Copy link
Author

On second thoughts, I'd prefer to not address this now. We plan to completely rewrite all of the core node stuff, anyway, at some point, so it seems better to leave it alone until then.

Replaced with #354, #355.

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

Successfully merging this pull request may close these issues.

2 participants