From bf6ffa3d11933e397d2135a97dfd73c624b4f864 Mon Sep 17 00:00:00 2001 From: 554325746@qq.com <554325746@qq.com> Date: 星期三, 21 八月 2019 14:03:38 +0800 Subject: [PATCH] add default shm param --- shm.go | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/shm.go b/shm.go index 5a87130..9260cdd 100644 --- a/shm.go +++ b/shm.go @@ -100,7 +100,6 @@ var param []int for _, v := range args { - fmt.Println(v) switch v.(type) { case int: param = append(param, v.(int)) @@ -109,13 +108,16 @@ return nil, errors.New("shmServer created recv error parameters") } } + blocks, size := 2, maxRecvSize if len(param) != 2 { return nil, errors.New("shmServer created recv too much parameters") } + blocks, size = param[0], param[1] + shm.Unlink(url) - rw, err := shm.CreateSimplex(url, 0644, param[0], param[1]) + rw, err := shm.CreateSimplex(url, 0644, blocks, size) if err == nil { fmt.Println(rw.Name()) return &SHM{ -- Gitblit v1.8.0