Merge pull request #2055 from joostjager/grpc1-15-0

build: upgrade grpc to 1.15.0
This commit is contained in:
Olaoluwa Osuntokun 2018-10-16 17:07:15 -07:00 committed by GitHub
commit 963c811d02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 8 deletions

24
Gopkg.lock generated

@ -189,14 +189,17 @@
revision = "a6af135bd4e28680facf08a3d206b454abc877a4" revision = "a6af135bd4e28680facf08a3d206b454abc877a4"
[[projects]] [[projects]]
digest = "1:19c3d5be42d5d503b94650e45bb2a01264bb36caff20f708e9cf67a6683b4c04" digest = "1:52f82517e64acdc35d16c476fb8bd9191aa205eb36a450a3fc0dd5b3fe27a4ab"
name = "github.com/golang/protobuf" name = "github.com/golang/protobuf"
packages = [ packages = [
"jsonpb", "jsonpb",
"proto", "proto",
"protoc-gen-go/descriptor", "protoc-gen-go/descriptor",
"ptypes",
"ptypes/any", "ptypes/any",
"ptypes/duration",
"ptypes/struct", "ptypes/struct",
"ptypes/timestamp",
] ]
pruneopts = "UT" pruneopts = "UT"
revision = "bbd03ef6da3a115852eaf24c8a1c46aeb39aa175" revision = "bbd03ef6da3a115852eaf24c8a1c46aeb39aa175"
@ -434,27 +437,38 @@
revision = "df60624c1e9b9d2973e889c7a1cff73155da81c4" revision = "df60624c1e9b9d2973e889c7a1cff73155da81c4"
[[projects]] [[projects]]
digest = "1:8d9ccf0a790b530f94357a5d27e9c86fb53e862b6e0f9133c792269c0b567218" digest = "1:ab8e92d746fb5c4c18846b0879842ac8e53b3d352449423d0924a11f1020ae1b"
name = "google.golang.org/grpc" name = "google.golang.org/grpc"
packages = [ packages = [
".", ".",
"balancer",
"balancer/base",
"balancer/roundrobin",
"codes", "codes",
"connectivity", "connectivity",
"credentials", "credentials",
"grpclb/grpc_lb_v1", "encoding",
"encoding/proto",
"grpclog", "grpclog",
"internal", "internal",
"internal/backoff",
"internal/channelz",
"internal/envconfig",
"internal/grpcrand",
"internal/transport",
"keepalive", "keepalive",
"metadata", "metadata",
"naming", "naming",
"peer", "peer",
"resolver",
"resolver/dns",
"resolver/passthrough",
"stats", "stats",
"status", "status",
"tap", "tap",
"transport",
] ]
pruneopts = "UT" pruneopts = "UT"
revision = "b3ddf786825de56a4178401b7e174ee332173b66" revision = "8dea3dc473e90c8179e519d91302d0597c0ca1d1"
[[projects]] [[projects]]
digest = "1:9f0c81ca4b497d3723d0a66495d8a1efe277068b77ef3ad2d6460e480bf09bb3" digest = "1:9f0c81ca4b497d3723d0a66495d8a1efe277068b77ef3ad2d6460e480bf09bb3"

@ -108,7 +108,7 @@
[[constraint]] [[constraint]]
name = "google.golang.org/grpc" name = "google.golang.org/grpc"
revision = "b3ddf786825de56a4178401b7e174ee332173b66" revision = "8dea3dc473e90c8179e519d91302d0597c0ca1d1"
[[override]] [[override]]
name = "gopkg.in/errgo.v1" name = "gopkg.in/errgo.v1"

@ -1978,6 +1978,8 @@ func calculateFeeLimit(feeLimit *lnrpc.FeeLimit,
// bi-directional stream allowing clients to rapidly send payments through the // bi-directional stream allowing clients to rapidly send payments through the
// Lightning Network with a single persistent connection. // Lightning Network with a single persistent connection.
func (r *rpcServer) SendPayment(stream lnrpc.Lightning_SendPaymentServer) error { func (r *rpcServer) SendPayment(stream lnrpc.Lightning_SendPaymentServer) error {
var lock sync.Mutex
return r.sendPayment(&paymentStream{ return r.sendPayment(&paymentStream{
recv: func() (*rpcPaymentRequest, error) { recv: func() (*rpcPaymentRequest, error) {
req, err := stream.Recv() req, err := stream.Recv()
@ -1989,7 +1991,12 @@ func (r *rpcServer) SendPayment(stream lnrpc.Lightning_SendPaymentServer) error
SendRequest: req, SendRequest: req,
}, nil }, nil
}, },
send: stream.Send, send: func(r *lnrpc.SendResponse) error {
// Calling stream.Send concurrently is not safe.
lock.Lock()
defer lock.Unlock()
return stream.Send(r)
},
}) })
} }
@ -1999,6 +2006,8 @@ func (r *rpcServer) SendPayment(stream lnrpc.Lightning_SendPaymentServer) error
// rapidly send payments through the Lightning Network with a single persistent // rapidly send payments through the Lightning Network with a single persistent
// connection. // connection.
func (r *rpcServer) SendToRoute(stream lnrpc.Lightning_SendToRouteServer) error { func (r *rpcServer) SendToRoute(stream lnrpc.Lightning_SendToRouteServer) error {
var lock sync.Mutex
return r.sendPayment(&paymentStream{ return r.sendPayment(&paymentStream{
recv: func() (*rpcPaymentRequest, error) { recv: func() (*rpcPaymentRequest, error) {
req, err := stream.Recv() req, err := stream.Recv()
@ -2028,7 +2037,12 @@ func (r *rpcServer) SendToRoute(stream lnrpc.Lightning_SendToRouteServer) error
routes: routes, routes: routes,
}, nil }, nil
}, },
send: stream.Send, send: func(r *lnrpc.SendResponse) error {
// Calling stream.Send concurrently is not safe.
lock.Lock()
defer lock.Unlock()
return stream.Send(r)
},
}) })
} }
@ -2319,6 +2333,10 @@ func (r *rpcServer) sendPayment(stream *paymentStream) error {
defer func() { defer func() {
close(reqQuit) close(reqQuit)
}() }()
// TODO(joostjager): Callers expect result to come in in the same order
// as the request were sent, but this is far from guarantueed in the
// code below.
go func() { go func() {
for { for {
select { select {