新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!

Commit 65138938 authored by gh lu's avatar gh lu

fix: revert pbpool

--bug=0
parent bb55d5a0
gen:
cd pb/proto && protoc \
--gogofaster_out=plugins=grpc:../protogo \
--gogofaster_opt=paths=source_relative \
--go-vtproto_out=../protogo --plugin protoc-gen-go-vtproto="$(GOPATH)/bin/protoc-gen-go-vtproto" \
--go-vtproto_opt=paths=source_relative \
--go-vtproto_opt=features=pool \
--go-vtproto_opt=pool=chainmaker.org/chainmaker/contract-sdk-go/pb/protogo.DockerVMMessage \
dockervm_message.proto
cd pb/proto && protoc -I=. --gogofaster_out=plugins=grpc:../protogo --gogofaster_opt=paths=source_relative dockervm_message.proto
mockgen:
mockgen -destination ./sdk/mock_sdk_interface.go -package sdk -source ./sdk/sdk_interface.go
......
// Code generated by protoc-gen-go-vtproto. DO NOT EDIT.
// protoc-gen-go-vtproto version: v0.3.0
// source: dockervm_message.proto
package protogo
import (
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
var vtprotoPool_DockerVMMessage = sync.Pool{
New: func() interface{} {
return &DockerVMMessage{}
},
}
func (m *DockerVMMessage) ResetVT() {
m.Reset()
}
func (m *DockerVMMessage) ReturnToVTPool() {
if m != nil {
m.ResetVT()
vtprotoPool_DockerVMMessage.Put(m)
}
}
func DockerVMMessageFromVTPool() *DockerVMMessage {
return vtprotoPool_DockerVMMessage.Get().(*DockerVMMessage)
}
......@@ -106,8 +106,7 @@ func (c *ContractEngineClient) listenTxRequest() error {
// holds return values from gRPC Recv below
// recv message
for {
msg := protogo.DockerVMMessageFromVTPool()
err := c.rpcClient.RecvMsg(msg)
msg, err := c.rpcClient.Recv()
switch {
case err != nil:
err := fmt.Errorf("client receive error from contract engine: %s", err)
......
......@@ -69,8 +69,7 @@ func (r *RuntimeClient) recvRoutine() error {
r.logger.Debugf("close runtime client receive goroutine")
return errors.New("close runtime client receive goroutine")
default:
receivedMsg := protogo.DockerVMMessageFromVTPool()
recvErr := r.rpcClient.RecvMsg(receivedMsg)
receivedMsg, recvErr := r.rpcClient.Recv()
if recvErr != nil {
r.logger.Errorf("client receive err from runtime %s", recvErr)
......@@ -100,7 +99,6 @@ func (r *RuntimeClient) recvRoutine() error {
default:
r.logger.Errorf("unknown message type, received msg: [%v]", receivedMsg)
}
//receivedMsg.ReturnToVTPool()
}
}
}
......
......@@ -153,9 +153,7 @@ func (t *TxDuration) addSysCallDuration(duration *SysCallDuration) {
// EnterNextStep enter next duration tx step
func EnterNextStep(msg *protogo.DockerVMMessage, stepType protogo.StepType, log string) {
if len(msg.StepDurations) == 0 {
return
}
if stepType != protogo.StepType_RUNTIME_PREPARE_TX_REQUEST {
endTxStep(msg)
}
......
......@@ -121,7 +121,6 @@ func (h *TxHandler) handleTxRequest(msg *protogo.DockerVMMessage) error {
defer func() {
currentTxDuration.TotalDuration = time.Since(startTime).Nanoseconds()
h.sandboxLogger.Debugf(currentTxDuration.ToString())
msg.ReturnToVTPool()
}()
args := msg.GetRequest().GetParameters()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment