fix hop http plugin
This commit is contained in:
parent
8bdd7ee172
commit
43d37d0a5f
@ -24,10 +24,6 @@ type httpPluginRequest struct {
|
||||
Src string `json:"src"`
|
||||
}
|
||||
|
||||
type httpPluginResponse struct {
|
||||
Node string `json:"node"`
|
||||
}
|
||||
|
||||
type httpPlugin struct {
|
||||
name string
|
||||
url string
|
||||
@ -101,18 +97,8 @@ func (p *httpPlugin) Select(ctx context.Context, opts ...hop.SelectOption) *chai
|
||||
return nil
|
||||
}
|
||||
|
||||
res := httpPluginResponse{}
|
||||
if err := json.NewDecoder(resp.Body).Decode(&res); err != nil {
|
||||
p.log.Error(resp.Status)
|
||||
return nil
|
||||
}
|
||||
|
||||
if res.Node == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
var cfg config.NodeConfig
|
||||
if err := json.NewDecoder(bytes.NewReader([]byte(res.Node))).Decode(&cfg); err != nil {
|
||||
if err := json.NewDecoder(resp.Body).Decode(&cfg); err != nil {
|
||||
p.log.Error(err)
|
||||
return nil
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ func (l *udpListener) parseMetadata(md mdata.Metadata) (err error) {
|
||||
readBufferSize = "readBufferSize"
|
||||
readQueueSize = "readQueueSize"
|
||||
backlog = "backlog"
|
||||
keepAlive = "keepAlive"
|
||||
keepalive = "keepalive"
|
||||
ttl = "ttl"
|
||||
)
|
||||
|
||||
@ -49,7 +49,7 @@ func (l *udpListener) parseMetadata(md mdata.Metadata) (err error) {
|
||||
if l.md.backlog <= 0 {
|
||||
l.md.backlog = defaultBacklog
|
||||
}
|
||||
l.md.keepalive = mdutil.GetBool(md, keepAlive)
|
||||
l.md.keepalive = mdutil.GetBool(md, keepalive)
|
||||
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user