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
| package bhomeclient
|
| import "fmt"
|
| type Config struct {
| regKey int //注册的shmKey
| shmSize int //共享内存块的大小,默认是512M
| chSize int //reply或sub chan的size
| sendTimeOut int //millisecond
| recvTimeOut int //millisecond
| pubTimeOut int //millisecond
| fnLog func(...interface{})
| }
|
| func DefaultConfig() *Config {
| return &Config{
| regKey: 12,
| shmSize: 512,
| chSize: 5,
| sendTimeOut: 100,
| recvTimeOut: 10,
| pubTimeOut: 100,
| fnLog: func(v ...interface{}) {
| fmt.Println(v...)
| },
| }
| }
|
|
| func NewConfig(regKey_ int,shmSize_ int, chSize_ int, sendTimeOut_ int, recvTimeOut_ int, pubTimeOut_ int, logFn func(...interface{})) *Config {
| return &Config{
| regKey: regKey_,
| shmSize: shmSize_,
| chSize: chSize_,
| sendTimeOut: sendTimeOut_,
| recvTimeOut: recvTimeOut_,
| pubTimeOut: pubTimeOut_,
| fnLog:logFn,
| }
| }
|
|