-
Notifications
You must be signed in to change notification settings - Fork 27
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
Change use of NodeItem to AddrPort in node base classes #350
Conversation
Note to reviewer: could you confirm the changes around |
(I was originally intending to replace all internal usage of |
Blocked pending testing with proto and node repos. |
@@ -38,9 +39,20 @@ public interface INodeInfo | |||
|
|||
**************************************************************************/ | |||
|
|||
deprecated("Use addr_port instead") | |||
public NodeItem node_item ( ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecation node?
There was a problem hiding this comment.
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 ( ); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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)
.
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.
8945a7f
to
05262d3
Compare
No description provided.