()
| 39 | ) |
| 40 | |
| 41 | func InitAgent() error { |
| 42 | protocol := &tcp.DefaultProtocol{} |
| 43 | protocol.SetMaxPacketSize(uint32(GlobalConfig.MaxPacketSize)) |
| 44 | s := tcp.NewAsyncTCPServer(GlobalConfig.TCPBind, &callback{}, protocol) |
| 45 | agent = Agent{ |
| 46 | s, |
| 47 | &types.Host{}, |
| 48 | &tcp.TCPConn{}, |
| 49 | &tcp.TCPConn{}, |
| 50 | make(chan types.TimeSeriesData, GlobalConfig.BufferSize), |
| 51 | // make(map[string]float64), |
| 52 | types.NewTimeSeriesDataStore(), |
| 53 | } |
| 54 | agent.dialCFC() |
| 55 | agent.dialRepeater() |
| 56 | agent.hostcfg = newHostConfig() |
| 57 | return agent.ListenAndServe() |
| 58 | } |
| 59 | |
| 60 | // 连接cfc |
| 61 | func (agent *Agent) dialCFC() error { |
no test coverage detected