@olane/o-client-limited 0.7.12-alpha.51 → 0.7.12-alpha.52
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,5 +1,9 @@
|
|
|
1
1
|
import { Stream } from '@olane/o-config';
|
|
2
2
|
import { oNodeConnection } from '@olane/o-node';
|
|
3
|
+
/**
|
|
4
|
+
* oLimitedConnection extends oNodeConnection with stream reuse enabled
|
|
5
|
+
* This is optimized for limited connections where creating new streams is expensive
|
|
6
|
+
*/
|
|
3
7
|
export declare class oLimitedConnection extends oNodeConnection {
|
|
4
8
|
getOrCreateStream(): Promise<Stream>;
|
|
5
9
|
postTransmit(stream: Stream): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-limited-connection.d.ts","sourceRoot":"","sources":["../../../src/connection/o-limited-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"o-limited-connection.d.ts","sourceRoot":"","sources":["../../../src/connection/o-limited-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,eAAe;IAC/C,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC;IAmBpC,YAAY,CAAC,MAAM,EAAE,MAAM;CAQlC"}
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import { oError, oErrorCodes, } from '@olane/o-core';
|
|
2
1
|
import { oNodeConnection } from '@olane/o-node';
|
|
2
|
+
/**
|
|
3
|
+
* oLimitedConnection extends oNodeConnection with stream reuse enabled
|
|
4
|
+
* This is optimized for limited connections where creating new streams is expensive
|
|
5
|
+
*/
|
|
3
6
|
export class oLimitedConnection extends oNodeConnection {
|
|
4
7
|
async getOrCreateStream() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
this.
|
|
16
|
-
return super.getOrCreateStream();
|
|
8
|
+
// Override to use 'reuse' policy
|
|
9
|
+
const streamConfig = {
|
|
10
|
+
signal: this.abortSignal,
|
|
11
|
+
maxOutboundStreams: process.env.MAX_OUTBOUND_STREAMS
|
|
12
|
+
? parseInt(process.env.MAX_OUTBOUND_STREAMS)
|
|
13
|
+
: 1000,
|
|
14
|
+
runOnLimitedConnection: this.config.runOnLimitedConnection ?? false,
|
|
15
|
+
reusePolicy: 'reuse', // Enable stream reuse
|
|
16
|
+
drainTimeoutMs: this.config.drainTimeoutMs,
|
|
17
|
+
};
|
|
18
|
+
return this.streamHandler.getOrCreateStream(this.p2pConnection, this.nextHopAddress.protocol, streamConfig);
|
|
17
19
|
}
|
|
18
20
|
async postTransmit(stream) {
|
|
19
|
-
//
|
|
21
|
+
// Use StreamHandler with reuse policy - stream won't be closed
|
|
22
|
+
const streamConfig = {
|
|
23
|
+
reusePolicy: 'reuse',
|
|
24
|
+
};
|
|
25
|
+
await this.streamHandler.close(stream, streamConfig);
|
|
20
26
|
}
|
|
21
27
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-client-limited",
|
|
3
|
-
"version": "0.7.12-alpha.
|
|
3
|
+
"version": "0.7.12-alpha.52",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -53,13 +53,13 @@
|
|
|
53
53
|
"typescript": "5.4.5"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@olane/o-config": "0.7.12-alpha.
|
|
57
|
-
"@olane/o-core": "0.7.12-alpha.
|
|
58
|
-
"@olane/o-lane": "0.7.12-alpha.
|
|
59
|
-
"@olane/o-protocol": "0.7.12-alpha.
|
|
60
|
-
"@olane/o-tool": "0.7.12-alpha.
|
|
56
|
+
"@olane/o-config": "0.7.12-alpha.52",
|
|
57
|
+
"@olane/o-core": "0.7.12-alpha.52",
|
|
58
|
+
"@olane/o-lane": "0.7.12-alpha.52",
|
|
59
|
+
"@olane/o-protocol": "0.7.12-alpha.52",
|
|
60
|
+
"@olane/o-tool": "0.7.12-alpha.52",
|
|
61
61
|
"debug": "^4.4.1",
|
|
62
62
|
"dotenv": "^16.5.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "f916d978a6cc64c8d21881d08a79b450bc85cce1"
|
|
65
65
|
}
|