提交 83cc99ad 编写于 作者: V vongosling

Merge branch 'develop' of github.com:apache/rocketmq into develop

...@@ -94,7 +94,7 @@ public class AclUtils { ...@@ -94,7 +94,7 @@ public class AclUtils {
} }
} }
public static String v6ipProcess(String netaddress, String[] strArray, int index) { public static String v6ipProcess(String netaddress) {
int part; int part;
String subAddress; String subAddress;
boolean isAsterisk = isAsterisk(netaddress); boolean isAsterisk = isAsterisk(netaddress);
......
...@@ -153,7 +153,7 @@ public class RemoteAddressStrategyFactory { ...@@ -153,7 +153,7 @@ public class RemoteAddressStrategyFactory {
for (int i = 1; i < strArray.length; i++) { for (int i = 1; i < strArray.length; i++) {
if (ipv6Analysis(strArray, i)) { if (ipv6Analysis(strArray, i)) {
AclUtils.verify(remoteAddr, index - 1); AclUtils.verify(remoteAddr, index - 1);
String preAddress = AclUtils.v6ipProcess(remoteAddr, strArray, index); String preAddress = AclUtils.v6ipProcess(remoteAddr);
this.index = StringUtils.split(preAddress, ":").length; this.index = StringUtils.split(preAddress, ":").length;
this.head = preAddress; this.head = preAddress;
break; break;
......
...@@ -181,19 +181,23 @@ public class AclUtilsTest { ...@@ -181,19 +181,23 @@ public class AclUtilsTest {
public void v6ipProcessTest() { public void v6ipProcessTest() {
String remoteAddr = "5::7:6:1-200:*"; String remoteAddr = "5::7:6:1-200:*";
String[] strArray = StringUtils.split(remoteAddr, ":"); String[] strArray = StringUtils.split(remoteAddr, ":");
Assert.assertEquals(AclUtils.v6ipProcess(remoteAddr, strArray, 3), "0005:0000:0000:0000:0007:0006"); Assert.assertEquals(AclUtils.v6ipProcess(remoteAddr), "0005:0000:0000:0000:0007:0006");
// Assert.assertEquals(AclUtils.v6ipProcess(remoteAddr, strArray, 3), "0005:0000:0000:0000:0007:0006");
remoteAddr = "5::7:6:1-200"; remoteAddr = "5::7:6:1-200";
strArray = StringUtils.split(remoteAddr, ":"); strArray = StringUtils.split(remoteAddr, ":");
Assert.assertEquals(AclUtils.v6ipProcess(remoteAddr, strArray, 3), "0005:0000:0000:0000:0000:0007:0006"); Assert.assertEquals(AclUtils.v6ipProcess(remoteAddr), "0005:0000:0000:0000:0000:0007:0006");
// Assert.assertEquals(AclUtils.v6ipProcess(remoteAddr, strArray, 3), "0005:0000:0000:0000:0000:0007:0006");
remoteAddr = "5::7:6:*"; remoteAddr = "5::7:6:*";
strArray = StringUtils.split(remoteAddr, ":"); strArray = StringUtils.split(remoteAddr, ":");
Assert.assertEquals(AclUtils.v6ipProcess(remoteAddr, strArray, 3), "0005:0000:0000:0000:0000:0007:0006"); Assert.assertEquals(AclUtils.v6ipProcess(remoteAddr), "0005:0000:0000:0000:0000:0007:0006");
// Assert.assertEquals(AclUtils.v6ipProcess(remoteAddr, strArray, 3), "0005:0000:0000:0000:0000:0007:0006");
remoteAddr = "5:7:6:*"; remoteAddr = "5:7:6:*";
strArray = StringUtils.split(remoteAddr, ":"); strArray = StringUtils.split(remoteAddr, ":");
Assert.assertEquals(AclUtils.v6ipProcess(remoteAddr, strArray, 3), "0005:0007:0006"); Assert.assertEquals(AclUtils.v6ipProcess(remoteAddr), "0005:0007:0006");
// Assert.assertEquals(AclUtils.v6ipProcess(remoteAddr, strArray, 3), "0005:0007:0006");
} }
@Test @Test
......
...@@ -64,10 +64,8 @@ public class MQFaultStrategy { ...@@ -64,10 +64,8 @@ public class MQFaultStrategy {
if (pos < 0) if (pos < 0)
pos = 0; pos = 0;
MessageQueue mq = tpInfo.getMessageQueueList().get(pos); MessageQueue mq = tpInfo.getMessageQueueList().get(pos);
if (latencyFaultTolerance.isAvailable(mq.getBrokerName())) { if (latencyFaultTolerance.isAvailable(mq.getBrokerName()))
if (null == lastBrokerName || mq.getBrokerName().equals(lastBrokerName)) return mq;
return mq;
}
} }
final String notBestBroker = latencyFaultTolerance.pickOneAtLeast(); final String notBestBroker = latencyFaultTolerance.pickOneAtLeast();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册