Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass name of connection to logs #843

Merged
merged 7 commits into from
Sep 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions pkg/netceptor/netceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -784,20 +784,20 @@
for {
select {
case <-time.After(5 * time.Second):
timedOut := make([]context.CancelFunc, 0)
timedOut := make(map[string]context.CancelFunc, 0)
s.connLock.RLock()
for i := range s.connections {
conn := s.connections[i]
conn.lastReceivedLock.RLock()
if time.Since(conn.lastReceivedData) > s.maxConnectionIdleTime {
timedOut = append(timedOut, s.connections[i].CancelFunc)
for conn := range s.connections {
connInfo := s.connections[conn]
connInfo.lastReceivedLock.RLock()
if time.Since(connInfo.lastReceivedData) > s.maxConnectionIdleTime {
timedOut[conn] = s.connections[conn].CancelFunc

Check warning on line 793 in pkg/netceptor/netceptor.go

View check run for this annotation

Codecov / codecov/patch

pkg/netceptor/netceptor.go#L790-L793

Added lines #L790 - L793 were not covered by tests
}
conn.lastReceivedLock.RUnlock()
connInfo.lastReceivedLock.RUnlock()

Check warning on line 795 in pkg/netceptor/netceptor.go

View check run for this annotation

Codecov / codecov/patch

pkg/netceptor/netceptor.go#L795

Added line #L795 was not covered by tests
}
s.connLock.RUnlock()
for i := range timedOut {
s.Logger.Warning("Timing out connection, idle for the past %s\n", s.maxConnectionIdleTime)
timedOut[i]()
for conn := range timedOut {
s.Logger.Warning("Timing out connection %s, idle for the past %s\n", conn, s.maxConnectionIdleTime)
timedOut[conn]()

Check warning on line 800 in pkg/netceptor/netceptor.go

View check run for this annotation

Codecov / codecov/patch

pkg/netceptor/netceptor.go#L799-L800

Added lines #L799 - L800 were not covered by tests
}
case <-s.context.Done():
return
Expand Down Expand Up @@ -922,13 +922,13 @@
defer s.connLock.RUnlock()
for conn, ci := range s.connections {
if conn != excludeConn {
go func(ci *connInfo) {
go func(conn string, ci *connInfo) {
select {
case ci.WriteChan <- message:
case <-ci.Context.Done():
s.Logger.Debug("connInfo cancelled during flood write")
s.Logger.Debug("connInfo for connection %s cancelled during flood write", conn)

Check warning on line 929 in pkg/netceptor/netceptor.go

View check run for this annotation

Codecov / codecov/patch

pkg/netceptor/netceptor.go#L929

Added line #L929 was not covered by tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would s.NodeID() be helpful in this log also @fosterseth ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not necessary in this case

}
}(ci)
}(conn, ci)
}
}
}
Expand Down
Loading