Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
feature: make the download port configurable
Browse files Browse the repository at this point in the history
supernode(java): -Dsupernode.downloadPort=xxx
the default value is 8001

Signed-off-by: lowzj <[email protected]>
  • Loading branch information
lowzj committed Jun 13, 2019
1 parent cc02c08 commit f5a5eb3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.dragonflyoss.dragonfly.supernode.config;

import javax.annotation.PostConstruct;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
Expand All @@ -25,10 +24,12 @@
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import javax.annotation.PostConstruct;

import com.alibaba.fastjson.JSON;

import com.dragonflyoss.dragonfly.supernode.common.Constants;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -79,6 +80,12 @@ public class SupernodeProperties {
*/
private String advertiseIp;

/**
* The downloadPort is used for clients to download file pieces from supernode.
* By default, the value is 8001.
*/
private int downloadPort = Constants.PORT;

@PostConstruct
public void init() {
String cdnHome = baseHome + "/repo";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.dragonflyoss.dragonfly.supernode.common.view.ResultCode;
import com.dragonflyoss.dragonfly.supernode.common.view.ResultInfo;
import com.dragonflyoss.dragonfly.supernode.common.view.TaskRegistryResult;
import com.dragonflyoss.dragonfly.supernode.config.SupernodeProperties;
import com.dragonflyoss.dragonfly.supernode.service.PeerRegistryService;
import com.dragonflyoss.dragonfly.supernode.service.PeerService;
import com.dragonflyoss.dragonfly.supernode.service.PeerTaskService;
Expand Down Expand Up @@ -60,6 +61,8 @@ public class PeerRegistryServiceImpl implements PeerRegistryService {
private DataGcService dataGcService;
@Autowired
private LockService lockService;
@Autowired
private SupernodeProperties properties;

@Override
public ResultInfo registryTask(String sourceUrl, String taskUrl, String md5, String bizId, String port,
Expand Down Expand Up @@ -153,7 +156,7 @@ public ResultInfo registryCdnNode(Task task) {
String taskId = task.getTaskId();

String cid = Constants.getSuperCid(taskId);
int port = Constants.PORT;
int port = properties.getDownloadPort();
String path = PathUtil.getHttpPath(taskId);
PeerInfo peerInfo = new PeerInfo();
peerInfo.setIp(Constants.localIp);
Expand Down

0 comments on commit f5a5eb3

Please sign in to comment.