X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fxds%2Fxds-agent.git;a=blobdiff_plain;f=lib%2Fagent%2Fxdsserver.go;h=f74e3ba4404c2d02718c1d7cdb105acfd0c8440d;hp=c08bfb1b17e6f2e700884271bfbdcc6ddaac1471;hb=80708aa2578f3598fc8abd4d08e576947da22872;hpb=1499569abc3e8440592add96f96e01791282a246 diff --git a/lib/agent/xdsserver.go b/lib/agent/xdsserver.go index c08bfb1..f74e3ba 100644 --- a/lib/agent/xdsserver.go +++ b/lib/agent/xdsserver.go @@ -39,6 +39,7 @@ import ( type XdsServer struct { *Context ID string + URLIndex string BaseURL string APIURL string PartialURL string @@ -83,6 +84,7 @@ func NewXdsServer(ctx *Context, conf xdsconfig.XDSServerConf) *XdsServer { return &XdsServer{ Context: ctx, ID: _IDTempoPrefix + uuid.NewV1().String(), + URLIndex: conf.URLIndex, BaseURL: conf.URL, APIURL: conf.APIBaseURL + conf.APIPartialURL, PartialURL: conf.APIPartialURL, @@ -155,6 +157,19 @@ func (xs *XdsServer) SetLoggerOutput(out io.Writer) { xs.logOut = out } +// GetConfig +func (xs *XdsServer) GetConfig() xaapiv1.ServerCfg { + return xaapiv1.ServerCfg{ + ID: xs.ID, + URL: xs.BaseURL, + APIURL: xs.APIURL, + PartialURL: xs.PartialURL, + ConnRetry: xs.ConnRetry, + Connected: xs.Connected, + Disabled: xs.Disabled, + } +} + // SendCommand Send a command to XDS Server func (xs *XdsServer) SendCommand(cmd string, body []byte, res interface{}) error { url := cmd @@ -303,6 +318,7 @@ func (xs *XdsServer) PassthroughPost(url string) { xs._Disconnected() } common.APIError(c, err.Error()) + return }) } @@ -353,6 +369,7 @@ func (xs *XdsServer) PassthroughPut(url string) { xs._Disconnected() } common.APIError(c, err.Error()) + return }) } @@ -396,6 +413,7 @@ func (xs *XdsServer) PassthroughDelete(url string) { xs._Disconnected() } common.APIError(c, err.Error()) + return }) } @@ -683,7 +701,7 @@ func (xs *XdsServer) _SocketConnect() error { }) iosk.On("disconnection", func(err error) { - xs.Log.Infof("IO.socket disconnection server %s", xs.ID) + xs.Log.Infof("IO.socket disconnection server %s (APIURL %s)", xs.ID, xs.APIURL) if xs.CBOnDisconnect != nil { xs.CBOnDisconnect(err) }