func newIPv4Adapter(context *ipv4.ServiceContext) *ipv4Adapter { log := Log.New("obj", "Connected By TCP IPv4 Adapter", "id", logext.RandId(8), "adapting", context.IP.String()) adapter := &ipv4Adapter{ updateChan: make(chan interface{}, 100), context: context, differ: lib.NewAllAtOnceDiffer(), stop: make(chan struct{}), log: log, } if err := adapter.differ.SetOutput(adapter.updateChan); err != nil { panic(fmt.Sprintf("newAdapter() could not set output: %v", err)) } go adapter.Serve() return adapter }
func newAdapter(port uint16, context *ipv4.ServiceContext) *ipv4Adapter { log := Log.New("obj", "example ipv4 adapter", "id", logext.RandId(8), "adapting", context.IP.String()) log.Info("example adapter created") adapter := &ipv4Adapter{ port: port, updateChan: make(chan interface{}, 100), context: context, differ: lib.NewAllAtOnceDiffer(), stop: make(chan struct{}), debgForceRefresh: make(chan struct{}, 10), log: log, } if err := adapter.differ.SetOutput(adapter.updateChan); err != nil { panic(fmt.Sprintf("newAdapter() could not set output: %v", err)) } go adapter.Serve() return adapter }