]> 127.0.0.1 Git - part/.git/commitdiff
fix v0.10.1
authorqydysky <32743305+qydysky@users.noreply.github.com>
Sat, 15 Oct 2022 18:45:21 +0000 (02:45 +0800)
committerqydysky <32743305+qydysky@users.noreply.github.com>
Sat, 15 Oct 2022 18:45:21 +0000 (02:45 +0800)
websocket/Recoder.go
websocket/Server_test.go

index ce0ad344de7902f06a94643884f72a3b263cd6c0..0faf4272aa1c0ed8d4aa2499409a5098eee8f4b8 100644 (file)
@@ -20,16 +20,15 @@ var (
 
 type Recorder struct {
        Server   *Server
-       FilePath string
        onlyOnce funcCtrl.SkipFunc
        stopflag *signal.Signal
 }
 
-func (t *Recorder) Start() error {
+func (t *Recorder) Start(filePath string) error {
        if t.Server == nil {
                return ErrSerIsNil
        }
-       if t.FilePath == "" {
+       if filePath == "" {
                return ErrFileNoSet
        }
        if t.onlyOnce.NeedSkip() {
@@ -37,7 +36,7 @@ func (t *Recorder) Start() error {
        }
 
        go func() {
-               f := file.New(t.FilePath, 0, false)
+               f := file.New(filePath, 0, false)
                defer f.Close()
 
                var startTimeStamp time.Time
index 749e5ffe416c859c10ddc12db6c4e8b0705ef24e..ccf3689e44c8a5e95c9fe48d299d2b7c94cec74c 100644 (file)
@@ -18,10 +18,9 @@ func Test_Server(t *testing.T) {
                ws_mq := s.Interface()
 
                recoder := &Recorder{
-                       Server:   s,
-                       FilePath: "l.csv",
+                       Server: s,
                }
-               recoder.Start()
+               recoder.Start("l.csv")
                defer recoder.Stop()
 
                ws_mq.Pull_tag(map[string]func(interface{}) bool{