Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
Signed-off-by: yongjie.yyj <yeyeyongjie@gmail.com>
  • Loading branch information
antJack committed Jun 16, 2023
1 parent 7a330ab commit 59ae99c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion contrib/golang/common/go/api/capi.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type HttpCAPI interface {
HttpSetTrailer(r unsafe.Pointer, key *string, value *string, add bool)
HttpRemoveTrailer(r unsafe.Pointer, key *string)

HttpGetStringValue(r *httpRequest, id int) (string, bool)
HttpGetStringValue(r unsafe.Pointer, id int) (string, bool)
HttpGetIntegerValue(r unsafe.Pointer, id int) (uint64, bool)

// TODO: HttpGetDynamicMetadata(r unsafe.Pointer, filterName string) map[string]interface{}
Expand Down
3 changes: 2 additions & 1 deletion contrib/golang/filters/http/source/go/pkg/http/capi_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ func (c *httpCApiImpl) HttpRemoveTrailer(r unsafe.Pointer, key *string) {
handleCApiStatus(res)
}

func (c *httpCApiImpl) HttpGetStringValue(r *httpRequest, id int) (string, bool) {
func (c *httpCApiImpl) HttpGetStringValue(rr unsafe.Pointer, id int) (string, bool) {
r := (*httpRequest)(rr)
var value string
// add a lock to protect filter->req_->strValue field in the Envoy side, from being writing concurrency,
// since there might be multiple concurrency goroutines invoking this API on the Go side.
Expand Down
14 changes: 7 additions & 7 deletions contrib/golang/filters/http/source/go/pkg/http/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ type streamInfo struct {
}

func (s *streamInfo) GetRouteName() string {
name, _ := cAPI.HttpGetStringValue(s.request, ValueRouteName)
name, _ := cAPI.HttpGetStringValue(unsafe.Pointer(s.request), ValueRouteName)
return name
}

func (s *streamInfo) FilterChainName() string {
name, _ := cAPI.HttpGetStringValue(s.request, ValueFilterChainName)
name, _ := cAPI.HttpGetStringValue(unsafe.Pointer(s.request), ValueFilterChainName)
return name
}

Expand All @@ -165,7 +165,7 @@ func (s *streamInfo) ResponseCode() (uint32, bool) {
}

func (s *streamInfo) ResponseCodeDetails() (string, bool) {
return cAPI.HttpGetStringValue(s.request, ValueResponseCodeDetails)
return cAPI.HttpGetStringValue(unsafe.Pointer(s.request), ValueResponseCodeDetails)
}

func (s *streamInfo) AttemptCount() uint32 {
Expand All @@ -188,21 +188,21 @@ func (d *dynamicMetadata) Set(filterName string, key string, value interface{})
}

func (s *streamInfo) DownstreamLocalAddress() string {
address, _ := cAPI.HttpGetStringValue(s.request, ValueDownstreamLocalAddress)
address, _ := cAPI.HttpGetStringValue(unsafe.Pointer(s.request), ValueDownstreamLocalAddress)
return address
}

func (s *streamInfo) DownstreamRemoteAddress() string {
address, _ := cAPI.HttpGetStringValue(s.request, ValueDownstreamRemoteAddress)
address, _ := cAPI.HttpGetStringValue(unsafe.Pointer(s.request), ValueDownstreamRemoteAddress)
return address
}

func (s *streamInfo) UpstreamHostAddress() (string, bool) {
return cAPI.HttpGetStringValue(s.request, ValueUpstreamHostAddress)
return cAPI.HttpGetStringValue(unsafe.Pointer(s.request), ValueUpstreamHostAddress)
}

func (s *streamInfo) UpstreamClusterName() (string, bool) {
return cAPI.HttpGetStringValue(s.request, ValueUpstreamClusterName)
return cAPI.HttpGetStringValue(unsafe.Pointer(s.request), ValueUpstreamClusterName)
}

type filterState struct {
Expand Down

0 comments on commit 59ae99c

Please sign in to comment.