switchup init

This commit is contained in:
Asim 2015-12-18 01:21:56 +00:00
parent 4cba0c57ab
commit a5be9ca585
2 changed files with 7 additions and 25 deletions

View File

@ -136,23 +136,14 @@ func (r *rpcClient) stream(ctx context.Context, address string, req Request) (St
return nil, errors.InternalServerError("go.micro.client", fmt.Sprintf("Error sending request: %v", err))
}
codec := newRpcPlusCodec(msg, c, cf)
err = codec.WriteRequest(&request{
Service: req.Service(),
ServiceMethod: req.Method(),
Seq: 0,
}, req.Request())
if err != nil {
return nil, errors.InternalServerError("go.micro.client", err.Error())
}
return &rpcStream{
stream := &rpcStream{
context: ctx,
request: req,
codec: codec,
}, nil
codec: newRpcPlusCodec(msg, c, cf),
}
err = stream.Send(req.Request())
return stream, err
}
func (r *rpcClient) CallRemote(ctx context.Context, address string, request Request, response interface{}, opts ...CallOption) error {

View File

@ -64,20 +64,11 @@ func stream() {
return
}
fmt.Println("sending request")
if err := stream.Send(&example.StreamingRequest{
Count: int64(10),
}); err != nil {
fmt.Println("err", err)
return
}
fmt.Println("sent request")
for stream.Error() == nil {
rsp := &example.StreamingResponse{}
err := stream.Recv(rsp)
if err != nil {
fmt.Println(err)
fmt.Println("recv err", err)
break
}
fmt.Println("Stream: rsp:", rsp.Count)