From 62546a29378082098705b6ffff45a0d1ca46931c Mon Sep 17 00:00:00 2001 From: wangxiaoxiong Date: Wed, 29 Jun 2022 16:43:25 +0800 Subject: [PATCH] style:change bool to struct{} --- pkg/protocol/message/other_message.go | 4 ++-- pkg/remoting/getty/getty_remoting.go | 2 +- pkg/remoting/processor/client/client_on_response_processor.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/protocol/message/other_message.go b/pkg/protocol/message/other_message.go index e3ede2b90..52e3cd65c 100644 --- a/pkg/protocol/message/other_message.go +++ b/pkg/protocol/message/other_message.go @@ -30,13 +30,13 @@ type MessageFuture struct { ID int32 Err error Response interface{} - Done chan bool + Done chan struct{} } func NewMessageFuture(message RpcMessage) *MessageFuture { return &MessageFuture{ ID: message.ID, - Done: make(chan bool), + Done: make(chan struct{}), } } diff --git a/pkg/remoting/getty/getty_remoting.go b/pkg/remoting/getty/getty_remoting.go index 0bc99bd4a..ffc24fc01 100644 --- a/pkg/remoting/getty/getty_remoting.go +++ b/pkg/remoting/getty/getty_remoting.go @@ -146,7 +146,7 @@ func (client *GettyRemoting) NotifyRpcMessageResponse(rpcMessage message.RpcMess messageFuture.Response = rpcMessage.Body // todo add messageFuture.Err //messageFuture.Err = rpcMessage.Err - messageFuture.Done <- true + messageFuture.Done <- struct{}{} //client.msgFutures.Delete(rpcMessage.RequestID) } else { log.Infof("msg: {} is not found in msgFutures.", rpcMessage.ID) diff --git a/pkg/remoting/processor/client/client_on_response_processor.go b/pkg/remoting/processor/client/client_on_response_processor.go index 53ad51b64..d811cabb4 100644 --- a/pkg/remoting/processor/client/client_on_response_processor.go +++ b/pkg/remoting/processor/client/client_on_response_processor.go @@ -55,7 +55,7 @@ func (f *clientOnResponseProcessor) Process(ctx context.Context, rpcMessage mess response := getty2.GetGettyRemotingInstance().GetMessageFuture(msgID) if response != nil { response.Response = mergedResult.Msgs[i] - response.Done <- true + response.Done <- struct{}{} getty2.GetGettyRemotingInstance().RemoveMessageFuture(msgID) } }