grpc_async_bidirectional_stream_example icon indicating copy to clipboard operation
grpc_async_bidirectional_stream_example copied to clipboard

双向流测试时,服务端流写入问题

Open wanghyu opened this issue 11 months ago • 0 comments

最近测试时,发现,双向流,服务端在流写入结束后,貌似没有写入一个stream.Finish(grpc::Status::OK,)这样的,我用go 客户端接收服务端流信息时,收不到 IO.EOF/

我调试看,每次都是closestream 然后调用OnExit就结束了。 而且感觉,调用了很多次OnExit.

不知道是哪里用错了,还是,尝试debug,但是里面状态机状态有点多。。

Go grpc客户端 for { //fmt.Println("for.....") res, err := stream.Recv() if err == io.EOF { fmt.Println("server closed") break } if err != nil { //fmt.Printf("reve error %s\n", err) continue } //这个能收到服务端的消息。 但是收不到io.EOF fmt.Printf("res answer %s\n", res.Answer)

	resList = append(resList, types.Response{
		Message: res.Answer,
	})

}

0x34a8840 ReadMsg Close 0x34a8840 ReadMsg Proceed 0x34ab818 SetStatus status:2 0x34ab818 Proceed Finish 0x34ab818 Msg_TestAgora_Stream2::OnExit 0x34a8870 WriteMsg Proceed 0x34ab818 SetStatus status:3 0x34ab818 Proceed Finish 0x34ab818 Msg_TestAgora_Stream2::OnExit NotifyMsg Proceed 0x34ab818 Release 0x34ab818 Msg_TestAgora_Stream2::OnExit 0x34ab818 Proceed Closed

wanghyu avatar Oct 30 '24 07:10 wanghyu