-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.go
55 lines (45 loc) · 842 Bytes
/
setup.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package sync
import (
"log"
"sync"
"github.com/fsnotify/fsnotify"
qp "github.com/quic-s/quics-protocol"
)
var (
QPClient *qp.QP
Conn *qp.Connection
Watcher *fsnotify.Watcher
PSMut map[byte]*sync.Mutex
PSMutModNum uint8 = 64
)
func init() {
// InitQPClient()
}
func InitQPClient() {
//newClient, err := qp.New(qp.LOG_LEVEL_INFO)
newClient, err := qp.New(qp.LOG_LEVEL_ERROR)
if err != nil {
panic(err)
}
QPClient = newClient
PSMut = make(map[byte]*sync.Mutex)
for i := uint8(0); i < PSMutModNum; i++ {
PSMut[i] = &sync.Mutex{}
}
MustSyncMain()
ForceSyncMain()
FullScanMain()
NeedContentMain()
}
func InitWatcher() {
// Create a new watcher.
err := error(nil)
Watcher, err = fsnotify.NewWatcher()
if err != nil {
log.Fatal(err)
}
}
func CloseConnect() {
Conn.Close()
Conn = nil
}