Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Update FAQ.md #1553

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ After finishing distributing file from other peers, `dfget` should do two kinds
- second, backup the unioned file(s) in a configured directory, by default "$HOME/.small-dragonfly/data" with a suffix of ".server";
- third, move the original unioned file(s) to the destination path.

**NOTE**: The supernode cannot manage the cached file which is already distributed to peer nodes at all. For what will happen if the cached file on a peer is deleted, please refer to [What if you kill the dfget server process or delete the source files](#what-if-you-kill-the-dfget-server-process-or-delete-the-source-files)
**NOTE**: The supernode cannot manage the cached file which is already distributed to peer nodes at all. For what will happen if the cached file on a peer is deleted, please refer to [What if you kill the dfget server process or delete the source files](#what-will-happen-if-you-kill-the-dfget-server-process-or-delete-the-source-files)

## What is the sequence of supernode's CDN functionality

Expand All @@ -61,7 +61,7 @@ If the requested file has already been cached in supernode, supernode will send

In addition, supernode does not have to wait for all the piece downloading finished, so it can concurrently start pieces downloading once one piece has been downloaded.

## What will happen if you kill the dfget server process or delete the source files
## What will happen if you kill the dfget server process or delete the source files

If a file on a peer is deleted manually or by GC, the supernode won't know that. And in the subsequent scheduling, if multiple download tasks fail from this peer, the scheduler will add it to a blacklist. So do with that if the server process is killed or other abnormal conditions.

Expand Down Expand Up @@ -323,4 +323,4 @@ Please check the [CONTRIBUTING.md](CONTRIBUTING.md#join-dragonfly-as-a-member)
If supernodes are set in multiple-supernode mode, dfget will connect to one of these supernodes randomly.
Because dfget will randomize the order of all supernodes it knows and store them in a slice.
If dfget connects to the first supernode unsuccessfully, it will connect to the second supernode in the slice.
And so on until all the known supernodes fail to access twice, the dfget will exit with download failure.
And so on until all the known supernodes fail to access twice, the dfget will exit with download failure.
4 changes: 4 additions & 0 deletions pkg/netutils/netutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ func NetLimit() *rate.Rate {

// ExtractHost extracts host ip from the giving string.
func ExtractHost(hostAndPort string) string {
if stringutils.IsEmptyStr(hostAndPort) {
return ""
}

fields := strings.Split(strings.TrimSpace(hostAndPort), ":")
return fields[0]
}
Expand Down