@aztec/p2p 0.77.0-testnet-ignition.17 → 0.77.0-testnet-ignition.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection_sampler.d.ts","sourceRoot":"","sources":["../../../../src/services/reqresp/connection-sampler/connection_sampler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAShE,qBAAa,aAAa;IACxB,MAAM,CAAC,GAAG,EAAE,MAAM;CAGnB;AAED;;;;;;GAMG;AACH,qBAAa,iBAAiB;IAY1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAb1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkD;IACzE,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,eAAe,CAA0C;IAEjE,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAkC;IACzE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2C;IAGnE,OAAO,CAAC,SAAS,CAAkC;gBAGhC,MAAM,EAAE,MAAM,EACd,iBAAiB,GAAE,MAAc,EAAE,sBAAsB;IACzD,OAAO,GAAE,aAAmC;IAO/D;;OAEG;IACG,IAAI;IAaV;;;;;OAKG;IACH,OAAO,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS;IA+B7D;;;;;OAKG;IACH,gBAAgB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE;IAkClD;;;;;;OAMG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBrE;;;;OAIG;IACG,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"connection_sampler.d.ts","sourceRoot":"","sources":["../../../../src/services/reqresp/connection-sampler/connection_sampler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAShE,qBAAa,aAAa;IACxB,MAAM,CAAC,GAAG,EAAE,MAAM;CAGnB;AAED;;;;;;GAMG;AACH,qBAAa,iBAAiB;IAY1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAb1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkD;IACzE,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,eAAe,CAA0C;IAEjE,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAkC;IACzE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2C;IAGnE,OAAO,CAAC,SAAS,CAAkC;gBAGhC,MAAM,EAAE,MAAM,EACd,iBAAiB,GAAE,MAAc,EAAE,sBAAsB;IACzD,OAAO,GAAE,aAAmC;IAO/D;;OAEG;IACG,IAAI;IAaV;;;;;OAKG;IACH,OAAO,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS;IA+B7D;;;;;OAKG;IACH,gBAAgB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE;IAkClD;;;;;;OAMG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBrE;;;;OAIG;IACG,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA4B5C;;OAEG;YACW,uBAAuB;CAetC"}
|
|
@@ -138,7 +138,12 @@ export class RandomSampler {
|
|
|
138
138
|
* @param streamId - The stream id
|
|
139
139
|
*/ async close(streamId) {
|
|
140
140
|
try {
|
|
141
|
-
const
|
|
141
|
+
const streamAndPeerId = this.streams.get(streamId);
|
|
142
|
+
if (!streamAndPeerId) {
|
|
143
|
+
this.logger.warn(`Stream ${streamId} not found`);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const { stream, peerId } = streamAndPeerId;
|
|
142
147
|
const updatedActiveConnectionsCount = (this.activeConnectionsCount.get(peerId) ?? 1) - 1;
|
|
143
148
|
this.activeConnectionsCount.set(peerId, updatedActiveConnectionsCount);
|
|
144
149
|
this.logger.trace(`Closing connection to peer ${peerId.toString()}`, {
|
|
@@ -149,7 +154,7 @@ export class RandomSampler {
|
|
|
149
154
|
});
|
|
150
155
|
await stream?.close();
|
|
151
156
|
} catch (error) {
|
|
152
|
-
this.logger.
|
|
157
|
+
this.logger.error(`Failed to close connection to peer with stream id ${streamId}`, error);
|
|
153
158
|
} finally{
|
|
154
159
|
this.streams.delete(streamId);
|
|
155
160
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/p2p",
|
|
3
|
-
"version": "0.77.0-testnet-ignition.
|
|
3
|
+
"version": "0.77.0-testnet-ignition.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -65,14 +65,14 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@aztec/constants": "0.77.0-testnet-ignition.
|
|
69
|
-
"@aztec/epoch-cache": "0.77.0-testnet-ignition.
|
|
70
|
-
"@aztec/foundation": "0.77.0-testnet-ignition.
|
|
71
|
-
"@aztec/kv-store": "0.77.0-testnet-ignition.
|
|
72
|
-
"@aztec/noir-protocol-circuits-types": "0.77.0-testnet-ignition.
|
|
73
|
-
"@aztec/protocol-contracts": "0.77.0-testnet-ignition.
|
|
74
|
-
"@aztec/stdlib": "0.77.0-testnet-ignition.
|
|
75
|
-
"@aztec/telemetry-client": "0.77.0-testnet-ignition.
|
|
68
|
+
"@aztec/constants": "0.77.0-testnet-ignition.21",
|
|
69
|
+
"@aztec/epoch-cache": "0.77.0-testnet-ignition.21",
|
|
70
|
+
"@aztec/foundation": "0.77.0-testnet-ignition.21",
|
|
71
|
+
"@aztec/kv-store": "0.77.0-testnet-ignition.21",
|
|
72
|
+
"@aztec/noir-protocol-circuits-types": "0.77.0-testnet-ignition.21",
|
|
73
|
+
"@aztec/protocol-contracts": "0.77.0-testnet-ignition.21",
|
|
74
|
+
"@aztec/stdlib": "0.77.0-testnet-ignition.21",
|
|
75
|
+
"@aztec/telemetry-client": "0.77.0-testnet-ignition.21",
|
|
76
76
|
"@chainsafe/discv5": "9.0.0",
|
|
77
77
|
"@chainsafe/enr": "3.0.0",
|
|
78
78
|
"@chainsafe/libp2p-gossipsub": "13.0.0",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"xxhash-wasm": "^1.1.0"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
|
-
"@aztec/archiver": "
|
|
104
|
+
"@aztec/archiver": "0.77.0-testnet-ignition.21",
|
|
105
105
|
"@jest/globals": "^29.5.0",
|
|
106
106
|
"@types/jest": "^29.5.0",
|
|
107
107
|
"@types/node": "^18.14.6",
|
|
@@ -170,7 +170,13 @@ export class ConnectionSampler {
|
|
|
170
170
|
*/
|
|
171
171
|
async close(streamId: string): Promise<void> {
|
|
172
172
|
try {
|
|
173
|
-
const
|
|
173
|
+
const streamAndPeerId = this.streams.get(streamId);
|
|
174
|
+
if (!streamAndPeerId) {
|
|
175
|
+
this.logger.warn(`Stream ${streamId} not found`);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const { stream, peerId } = streamAndPeerId;
|
|
174
180
|
|
|
175
181
|
const updatedActiveConnectionsCount = (this.activeConnectionsCount.get(peerId) ?? 1) - 1;
|
|
176
182
|
this.activeConnectionsCount.set(peerId, updatedActiveConnectionsCount);
|
|
@@ -184,7 +190,7 @@ export class ConnectionSampler {
|
|
|
184
190
|
|
|
185
191
|
await stream?.close();
|
|
186
192
|
} catch (error) {
|
|
187
|
-
this.logger.
|
|
193
|
+
this.logger.error(`Failed to close connection to peer with stream id ${streamId}`, error);
|
|
188
194
|
} finally {
|
|
189
195
|
this.streams.delete(streamId);
|
|
190
196
|
}
|