Skip to content

Commit 239aab8

Browse files
authored
Merge pull request #9875 from ziggie1984/fix-peer-connection-2
discovery: make sure we do not block the read queue
2 parents ac76d63 + 6f45735 commit 239aab8

File tree

4 files changed

+31
-7
lines changed

4 files changed

+31
-7
lines changed

discovery/gossiper.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,8 +860,6 @@ func (d *AuthenticatedGossiper) stop() {
860860
func (d *AuthenticatedGossiper) ProcessRemoteAnnouncement(ctx context.Context,
861861
msg lnwire.Message, peer lnpeer.Peer) chan error {
862862

863-
log.Debugf("Processing remote msg %T from peer=%x", msg, peer.PubKey())
864-
865863
errChan := make(chan error, 1)
866864

867865
// For messages in the known set of channel series queries, we'll

discovery/syncer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ const (
175175
requestBatchSize = 500
176176

177177
// syncerBufferSize is the size of the syncer's buffers.
178-
syncerBufferSize = 5
178+
syncerBufferSize = 50
179179
)
180180

181181
var (

docs/release-notes/release-notes-0.19.1.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
# Bug Fixes
2222

23-
* [Fix a serialisation bug](https://github.com/lightningnetwork/lnd/pull/9856)
23+
- [Fix a serialisation bug](https://github.com/lightningnetwork/lnd/pull/9856)
2424
that would occur when an attempt was made to write a backup file for a channel
2525
peer that has advertised an address that we do not yet know how to parse.
2626

@@ -38,6 +38,9 @@
3838

3939
## Functional Enhancements
4040

41+
- [Increase](https://github.com/lightningnetwork/lnd/pull/9875) gossip sync
42+
buffer to take the pressure of the read handler.
43+
4144
## RPC Additions
4245

4346
## lncli Additions

peer/brontide.go

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,9 +1995,32 @@ func newDiscMsgStream(p *Brontide) *msgStream {
19951995
// so that a parent context can be passed in here.
19961996
ctx := context.TODO()
19971997

1998-
// TODO(yy): `ProcessRemoteAnnouncement` returns an error chan
1999-
// and we need to process it.
2000-
p.cfg.AuthGossiper.ProcessRemoteAnnouncement(ctx, msg, p)
1998+
p.log.Debugf("Processing remote msg %T", msg)
1999+
2000+
errChan := p.cfg.AuthGossiper.ProcessRemoteAnnouncement(
2001+
ctx, msg, p,
2002+
)
2003+
2004+
// Start a goroutine to process the error channel for logging
2005+
// purposes.
2006+
//
2007+
// TODO(ziggie): Maybe use the error to potentially punish the
2008+
// peer depending on the error ?
2009+
go func() {
2010+
select {
2011+
case <-p.cg.Done():
2012+
return
2013+
2014+
case err := <-errChan:
2015+
if err != nil {
2016+
p.log.Warnf("Error processing remote "+
2017+
"msg %T: %v", msg,
2018+
err)
2019+
}
2020+
}
2021+
2022+
p.log.Debugf("Processed remote msg %T", msg)
2023+
}()
20012024
}
20022025

20032026
return newMsgStream(

0 commit comments

Comments
 (0)