Skip to content

Commit

Permalink
Indicate isRemote on InterceptMongoToClient (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomerYakir authored Feb 16, 2021
1 parent 86cf3d0 commit 153f8bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions inttests/int_test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type FindFixer struct {
cm *LightCursorManager
}

func (ff *FindFixer) InterceptMongoToClient(m Message, address address.Address) (Message, error) {
func (ff *FindFixer) InterceptMongoToClient(m Message, address address.Address, isRemote bool) (Message, error) {
switch mm := m.(type) {
case *MessageMessage:
doc, _, err := MessageMessageToBSOND(mm)
Expand Down Expand Up @@ -150,7 +150,7 @@ func fixIsMasterDirect(doc bson.D, mongoPort, proxyPort int) (SimpleBSON, error)
return SimpleBSONConvert(doc)
}

func (mri *IsMasterFixer) InterceptMongoToClient(m Message, address address.Address) (Message, error) {
func (mri *IsMasterFixer) InterceptMongoToClient(m Message, address address.Address, isRemote bool) (Message, error) {
switch mm := m.(type) {
case *ReplyMessage:
var err error
Expand Down
4 changes: 2 additions & 2 deletions proxy_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type MetricsHookFactory interface {
}

type ResponseInterceptor interface {
InterceptMongoToClient(m Message, serverAddress address.Address) (Message, error)
InterceptMongoToClient(m Message, serverAddress address.Address, isRemote bool) (Message, error)
}

type ProxyInterceptor interface {
Expand Down Expand Up @@ -614,7 +614,7 @@ func (ps *ProxySession) doLoop(mongoConn *MongoConnectionWrapper, retryError *Pr
}
}
if respInter != nil {
resp, err = respInter.InterceptMongoToClient(resp, mongoConn.conn.Address())
resp, err = respInter.InterceptMongoToClient(resp, mongoConn.conn.Address(), remoteRs != "")
if err != nil {
if ps.isMetricsEnabled {
hookErr := responseErrorsHook.IncCounterGauge()
Expand Down

0 comments on commit 153f8bf

Please sign in to comment.