1
0
mirror of https://github.com/schollz/croc.git synced 2024-11-24 16:23:47 +03:00

Merge pull request #459 from iulius98/master

#454 fixed local transfer
This commit is contained in:
Zack 2022-02-20 07:57:34 -08:00 committed by GitHub
commit 1bd705d2e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -338,12 +338,19 @@ func (c *Client) setupLocalRelay() {
}
func (c *Client) broadcastOnLocalNetwork(useipv6 bool) {
var timeLimit time.Duration
//if we don't use an external relay, the broadcast messages need to be sent continuously
if c.Options.OnlyLocal {
timeLimit = -1 * time.Second
} else {
timeLimit = 30 * time.Second
}
// look for peers first
settings := peerdiscovery.Settings{
Limit: -1,
Payload: []byte("croc" + c.Options.RelayPorts[0]),
Delay: 20 * time.Millisecond,
TimeLimit: 30 * time.Second,
TimeLimit: timeLimit,
}
if useipv6 {
settings.IPVersion = peerdiscovery.IPv6