mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-03 07:12:27 +00:00
wip
This commit is contained in:
parent
5912f32a34
commit
c717f08287
@ -15,6 +15,7 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/quic-go/quic-go"
|
||||
@ -22,6 +23,7 @@ import (
|
||||
"github.com/syncthing/syncthing/lib/config"
|
||||
"github.com/syncthing/syncthing/lib/connections/registry"
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
"github.com/syncthing/syncthing/lib/rand"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -95,6 +97,15 @@ func (d *quicDialer) Dial(ctx context.Context, _ protocol.DeviceID, uri *url.URL
|
||||
if isLocal {
|
||||
priority = d.lanPriority
|
||||
}
|
||||
|
||||
// XXX: Induced flakyness
|
||||
if dur, _ := time.ParseDuration(os.Getenv("CONN_FLAKY_LIFETIME")); dur > 0 {
|
||||
dur = dur/2 + time.Duration(rand.Intn(int(dur)))
|
||||
time.AfterFunc(dur, func() {
|
||||
stream.Close()
|
||||
})
|
||||
}
|
||||
|
||||
return newInternalConn(&quicTlsConn{session, stream, createdConn}, connTypeQUICClient, isLocal, priority), nil
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ func (d *tcpDialer) Dial(ctx context.Context, _ protocol.DeviceID, uri *url.URL)
|
||||
}
|
||||
|
||||
// XXX: Induced flakyness
|
||||
if dur, _ := time.ParseDuration(os.Getenv("TCP_FLAKY_LIFETIME")); dur > 0 {
|
||||
if dur, _ := time.ParseDuration(os.Getenv("CONN_FLAKY_LIFETIME")); dur > 0 {
|
||||
dur = dur/2 + time.Duration(rand.Intn(int(dur)))
|
||||
time.AfterFunc(dur, func() {
|
||||
tc.Close()
|
||||
|
@ -138,17 +138,17 @@ func (s *indexHandler) Serve(ctx context.Context) (err error) {
|
||||
close(stop)
|
||||
}()
|
||||
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
// ctx, cancel := context.WithCancel(ctx)
|
||||
|
||||
// Cancel the context when the connection closes
|
||||
go func() {
|
||||
select {
|
||||
case <-s.conn.Closed():
|
||||
cancel()
|
||||
case <-ctx.Done():
|
||||
case <-stop:
|
||||
}
|
||||
}()
|
||||
// go func() {
|
||||
// select {
|
||||
// case <-s.conn.Closed():
|
||||
// cancel()
|
||||
// case <-ctx.Done():
|
||||
// case <-stop:
|
||||
// }
|
||||
// }()
|
||||
|
||||
// Broadcast the pause cond when the context quits
|
||||
go func() {
|
||||
|
@ -2186,7 +2186,7 @@ func (m *model) Connection(deviceID protocol.DeviceID) (protocol.Connection, boo
|
||||
m.pmut.RLock()
|
||||
connID, ok := m.deviceConns[deviceID]
|
||||
if ok {
|
||||
conn = m.conns[connID[0]]
|
||||
conn, ok = m.conns[connID[0]]
|
||||
}
|
||||
m.pmut.RUnlock()
|
||||
if ok {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<configuration version="37">
|
||||
<folder id="default" label="" path="s1" type="sendreceive" rescanIntervalS="3600" fsWatcherEnabled="true" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
||||
<folder id="default" label="" path="s1?files=10000&sizeavg=25000000" type="sendreceive" rescanIntervalS="3600" fsWatcherEnabled="true" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">
|
||||
<filesystemType>fake</filesystemType>
|
||||
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" introducedBy="">
|
||||
<encryptionPassword></encryptionPassword>
|
||||
|
Loading…
Reference in New Issue
Block a user