Skip to content

Commit f0befcb

Browse files
authored
add contructor in ConnectionManager (#237)
1 parent ce1072f commit f0befcb

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

sdk-core/src/main/java/org/fisco/bcos/sdk/network/ConnectionManager.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,20 @@ public class ConnectionManager {
7676
private ScheduledExecutorService reconnSchedule = new ScheduledThreadPoolExecutor(1);
7777

7878
public ConnectionManager(ConfigOption configOption, MsgHandler msgHandler) {
79-
for (String peerIpPort : configOption.getNetworkConfig().getPeers()) {
80-
connectionInfoList.add(new ConnectionInfo(peerIpPort));
79+
this(configOption.getNetworkConfig().getPeers(), msgHandler);
80+
}
81+
82+
public ConnectionManager(List<String> ipList, MsgHandler msgHandler) {
83+
if (ipList != null) {
84+
for (String peerIpPort : ipList) {
85+
connectionInfoList.add(new ConnectionInfo(peerIpPort));
86+
}
8187
}
8288
channelHandler = new ChannelHandler(this, msgHandler);
83-
logger.info(" all connections: {}", connectionInfoList);
89+
logger.info(
90+
" all connections, size: {}, list: {}",
91+
connectionInfoList.size(),
92+
connectionInfoList);
8493
}
8594

8695
public void startConnect(ConfigOption configOption) throws NetworkException {

0 commit comments

Comments
 (0)