@@ -3,7 +3,6 @@ import * as IlpPacket from 'ilp-packet'
3
3
import { Reader } from 'oer-utils'
4
4
import { Connection , BuildConnectionOpts } from './connection'
5
5
import * as cryptoHelper from './crypto'
6
- import { AgingSet } from './util/aging-set'
7
6
8
7
const log = createLogger ( 'ilp-protocol-stream:Pool' )
9
8
const CLOSED_CONNECTION_CYCLE = 10 * 60 * 1000 // 10 minutes
@@ -20,8 +19,6 @@ export class ServerConnectionPool {
20
19
private onConnection : ConnectionEvent
21
20
private activeConnections : { [ id : string ] : Connection }
22
21
private pendingConnections : { [ id : string ] : Promise < Connection > }
23
- // Use an `AgingSet` so that the connection IDs stored don't accumulate indefinitely.
24
- private closedConnections : AgingSet = new AgingSet ( CLOSED_CONNECTION_CYCLE )
25
22
26
23
constructor (
27
24
serverSecret : Buffer ,
@@ -36,7 +33,6 @@ export class ServerConnectionPool {
36
33
}
37
34
38
35
async close ( ) : Promise < void > {
39
- this . closedConnections . close ( )
40
36
await Promise . all ( Object . keys ( this . activeConnections )
41
37
. map ( ( id : string ) => this . activeConnections [ id ] . end ( ) ) )
42
38
}
@@ -45,11 +41,6 @@ export class ServerConnectionPool {
45
41
id : string ,
46
42
prepare : IlpPacket . IlpPrepare
47
43
) : Promise < Connection > {
48
- if ( this . closedConnections . has ( id ) ) {
49
- log . debug ( 'got packet for connection that was already closed: %s' , id )
50
- throw new Error ( 'connection already closed' )
51
- }
52
-
53
44
const activeConnection = this . activeConnections [ id ]
54
45
if ( activeConnection ) return Promise . resolve ( activeConnection )
55
46
const pendingConnection = this . pendingConnections [ id ]
@@ -107,7 +98,6 @@ export class ServerConnectionPool {
107
98
conn . once ( 'close' , ( ) => {
108
99
delete this . pendingConnections [ id ]
109
100
delete this . activeConnections [ id ]
110
- this . closedConnections . add ( id )
111
101
} )
112
102
return conn
113
103
} ) ( )
0 commit comments