Added BiRPCClient to analyzers

This commit is contained in:
Trial97
2021-07-08 12:33:55 +03:00
committed by Dan Christian Bogos
parent d86fe1592b
commit 8fed2775dd
3 changed files with 47 additions and 2 deletions

View File

@@ -43,9 +43,46 @@ type AnalyzerConnector struct {
to string
}
func (c *AnalyzerConnector) Call(serviceMethod string, args interface{}, reply interface{}) (err error) {
func (c *AnalyzerConnector) Call(serviceMethod string, args, reply interface{}) (err error) {
sTime := time.Now()
err = c.conn.Call(serviceMethod, args, reply)
go c.aS.logTrafic(0, serviceMethod, args, reply, err, c.enc, c.from, c.to, sTime, time.Now())
return
}
func (aS *AnalyzerService) NewAnalyzerBiRPCConnector(sc rpcclient.BiRPCConector, enc, from, to string) rpcclient.BiRPCConector {
return &AnalyzerBiRPCConnector{
conn: sc,
aS: aS,
enc: enc,
from: from,
to: to,
}
}
type AnalyzerBiRPCConnector struct {
conn rpcclient.BiRPCConector
aS *AnalyzerService
enc string
from string
to string
}
func (c *AnalyzerBiRPCConnector) Call(serviceMethod string, args, reply interface{}) (err error) {
sTime := time.Now()
err = c.conn.Call(serviceMethod, args, reply)
go c.aS.logTrafic(0, serviceMethod, args, reply, err, c.enc, c.from, c.to, sTime, time.Now())
return
}
func (c *AnalyzerBiRPCConnector) CallBiRPC(cl rpcclient.ClientConnector, serviceMethod string, args, reply interface{}) (err error) {
sTime := time.Now()
err = c.conn.CallBiRPC(cl, serviceMethod, args, reply)
go c.aS.logTrafic(0, serviceMethod, args, reply, err, c.enc, c.from, c.to, sTime, time.Now())
return
}
func (c *AnalyzerBiRPCConnector) Handlers() map[string]interface{} {
return c.conn.Handlers()
}