Skip to content

Commit

Permalink
add docs, fix rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
likeazir committed Aug 28, 2023
1 parent 3349ee6 commit 25c8305
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion fileretriever/fileserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type FileServer struct {
}

func NewFileServer(srcDir string, bind string, fclient *FileClient, rateLimit int) *FileServer {
maxPacketsPerSecond := (float64(rateLimit) * math.Pow(float64(10), float64(8))) / float64(cache.BLOCKSIZE*8)
maxPacketsPerSecond := (float64(rateLimit) * math.Pow(float64(10), float64(6))) / float64(cache.BLOCKSIZE*8)
log.Trace().Msgf("Setting rate limit to %d data packets per second", maxPacketsPerSecond)
return &FileServer{srcDir: srcDir, bind: bind, fclient: fclient, limiter: rate.NewLimiter(rate.Limit(maxPacketsPerSecond), 2)}
}
Expand Down
12 changes: 6 additions & 6 deletions readnetfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ func (i *PeerAddress) Set(value string) error {
func main() {
zerolog.SetGlobalLevel(zerolog.TraceLevel)
log.Debug().Msg(strings.Join(os.Args, ","))
bindAddrPort := flag.String("bind", "", "bind address and port")
mntDir := flag.String("mnt", "", "mnt")
srcDir := flag.String("src", "", "src")
flag.Var(&PeerNodes, "peer", "peer address and port")
send := flag.Bool("send", false, "send")
receive := flag.Bool("receive", false, "receive")
bindAddrPort := flag.String("bind", "", "Bind address and port in x.x.x.x:port format")
mntDir := flag.String("mnt", "", "Directory to mount the net filesystem on")
srcDir := flag.String("src", "", "Directory to serve files from")
flag.Var(&PeerNodes, "peer", "Peer addresses and ports in x.x.x.x:port format, has to specified for each peer like so: -peer x.x.x.x:port -peer x.x.x.x:port ...")
send := flag.Bool("send", false, "Serve files from the src directory")
receive := flag.Bool("receive", false, "Receive files and mount the net filesystem on the mnt directory")
rateLimit := flag.Int("rate", 1000, "rate limit in Mbit/s")

flag.Parse()
Expand Down

0 comments on commit 25c8305

Please sign in to comment.