Commit a62c9889 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4c91dc61
...@@ -50,10 +50,18 @@ func (nodeUUID NodeUUID) String() string { ...@@ -50,10 +50,18 @@ func (nodeUUID NodeUUID) String() string {
// Addr converts network address string into NEO Address // Addr converts network address string into NEO Address
// TODO make neo.Address just string without host:port split // TODO make neo.Address just string without host:port split
func AddrString(network, addr string) (Address, error) { func AddrString(network, addr string) (Address, error) {
// e.g. on unix, pipenet, etc networks there is no host/port split - the address there // e.g. on unix, networks there is no host/port split - the address there
// is single string -> we put it into .Host and set .Port=0 to indicate such cases // is single string -> we put it into .Host and set .Port=0 to indicate such cases
if strings.HasPrefix(network, "tcp") || strings.HasPrefix(network, "udp") { switch {
default:
return Address{Host: addr, Port: 0}, nil
// networks that have host:port split // networks that have host:port split
case strings.HasPrefix(network, "tcp"):
case strings.HasPrefix(network, "udp"):
case strings.HasPrefix(network, "pipe"):
}
host, portstr, err := net.SplitHostPort(addr) host, portstr, err := net.SplitHostPort(addr)
if err != nil { if err != nil {
return Address{}, err return Address{}, err
...@@ -65,10 +73,6 @@ func AddrString(network, addr string) (Address, error) { ...@@ -65,10 +73,6 @@ func AddrString(network, addr string) (Address, error) {
} }
return Address{Host: host, Port: uint16(port)}, nil return Address{Host: host, Port: uint16(port)}, nil
}
return Address{Host: addr, Port: 0}, nil
} }
// Addr converts net.Addr into NEO Address // Addr converts net.Addr into NEO Address
......
...@@ -217,7 +217,13 @@ func TestMasterStorage(t *testing.T) { ...@@ -217,7 +217,13 @@ func TestMasterStorage(t *testing.T) {
//) //)
_ = nettx _ = nettx
tc.Expect(conntx("s:1", "m:1", 1, &neo.RequestIdentification{})) // XXX tc.Expect(conntx("s:1", "m:1", 1, &neo.RequestIdentification{
NodeType: neo.STORAGE,
NodeUUID: 0,
Address: neo.Address{"s", 0}, //XXX "s:0",
ClusterName: "abc1",
IdTimestamp: 0,
}))
// XXX ... M adjust nodetab... // XXX ... M adjust nodetab...
tc.Expect(conntx("m:1", "s:1", 1, &neo.AcceptIdentification{})) // XXX tc.Expect(conntx("m:1", "s:1", 1, &neo.AcceptIdentification{})) // XXX
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment