Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Clean up connections after websocket close #3352

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

borancar
Copy link
Contributor

Title:
Clean up connections after WebSocket close

Description:
Make sure we clean up connections by just going through the map and
cleaning all the verkeys that match the connection. This is a suboptimal
solution, but a connection close is not something happening often.

Fixes #3349

@@ -79,9 +79,7 @@ func (d *connPool) remove(verKey string) {
}

func (d *connPool) listener(conn *websocket.Conn, outbound bool) {
verKeys := []string{}
Copy link
Contributor Author

@borancar borancar Aug 26, 2022

Choose a reason for hiding this comment

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

These never get populated.

@borancar
Copy link
Contributor Author

If you like the approach, or if it's acceptable, then I can try to add tests.

Make sure we clean up connections by just going through the map and
cleaning all the verkeys that match the connection. This is a suboptimal
solution, but a connection close is not something happennig often.

Signed-off-by: Boran Car <[email protected]>
@codecov
Copy link

codecov bot commented Aug 29, 2022

Codecov Report

Merging #3352 (b1decdf) into main (a66828f) will decrease coverage by 0.05%.
The diff coverage is 61.95%.

❗ Current head b1decdf differs from pull request most recent head ffa35a9. Consider uploading reports for the commit ffa35a9 to get more accurate results

@@            Coverage Diff             @@
##             main    #3352      +/-   ##
==========================================
- Coverage   87.89%   87.84%   -0.06%     
==========================================
  Files         330      330              
  Lines       45571    45633      +62     
==========================================
+ Hits        40056    40087      +31     
- Misses       4085     4110      +25     
- Partials     1430     1436       +6     
Impacted Files Coverage Δ
pkg/didcomm/protocol/legacyconnection/service.go 86.74% <ø> (-0.08%) ⬇️
pkg/doc/presexch/definition.go 83.26% <59.77%> (-3.08%) ⬇️
pkg/didcomm/protocol/legacyconnection/states.go 87.20% <100.00%> (+0.04%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@borancar
Copy link
Contributor Author

linting with js/wasm..
Error: pkg/didcomm/transport/ws/pool.go:74:20: func `(*connPool).remove` is unused (unused)
func (d *connPool) remove(verKey string) {
                   ^
make: *** [lint] Error 1
Makefile:37: recipe for target 'lint' failed
Error: Process completed with exit code 2.

The unused check is incorrect (or possibly incomplete as it doesn't take the regular server into account), it's used here https://github.com/hyperledger/aries-framework-go/blob/b1decdfed852057fe64660b40ac705953b4d6d0f/pkg/didcomm/transport/ws/upgrade_srv.go#L28-L35

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Can't reconnect mediator after connection terminated from server side
1 participant