socket-function 1.1.17 → 1.1.19

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.
package/SocketFunction.ts CHANGED
@@ -16,7 +16,7 @@ import "./SetProcessVariables";
16
16
  import cborx from "cbor-x";
17
17
  import { setFlag } from "./require/compileFlags";
18
18
  import { isNode } from "./src/misc";
19
- import { getPendingCallCount, harvestCallTimes, harvestFailedCallCount, registerOwnReconnectionUrl } from "./src/CallFactory";
19
+ import { getPendingCallCount, harvestCallTimes, harvestFailedCallCount } from "./src/CallFactory";
20
20
  import { measureWrap } from "./src/profiling/measure";
21
21
 
22
22
  setFlag(require, "cbor-x", "allowclient", true);
package/index.d.ts CHANGED
@@ -495,7 +495,6 @@ declare module "socket-function/src/CallFactory" {
495
495
  }
496
496
  type InitializeState = {
497
497
  supportsLZ4?: boolean;
498
- ownReconnectionUrl?: string;
499
498
  };
500
499
  export declare function harvestFailedCallCount(): number;
501
500
  export declare function getPendingCallCount(): number;
@@ -504,7 +503,6 @@ declare module "socket-function/src/CallFactory" {
504
503
  end: number;
505
504
  }[];
506
505
  export declare function createCallFactory(webSocketBase: SenderInterface | undefined, nodeId: string, localNodeId?: string): Promise<CallFactory>;
507
- export declare function registerOwnReconnectionUrl(url: string): void;
508
506
  export {};
509
507
 
510
508
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socket-function",
3
- "version": "1.1.17",
3
+ "version": "1.1.19",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -34,7 +34,6 @@ export interface SenderInterface {
34
34
  }
35
35
  type InitializeState = {
36
36
  supportsLZ4?: boolean;
37
- ownReconnectionUrl?: string;
38
37
  };
39
38
  export declare function harvestFailedCallCount(): number;
40
39
  export declare function getPendingCallCount(): number;
@@ -43,5 +42,4 @@ export declare function harvestCallTimes(): {
43
42
  end: number;
44
43
  }[];
45
44
  export declare function createCallFactory(webSocketBase: SenderInterface | undefined, nodeId: string, localNodeId?: string): Promise<CallFactory>;
46
- export declare function registerOwnReconnectionUrl(url: string): void;
47
45
  export {};
@@ -78,7 +78,6 @@ export interface SenderInterface {
78
78
 
79
79
  type InitializeState = {
80
80
  supportsLZ4?: boolean;
81
- ownReconnectionUrl?: string;
82
81
  };
83
82
 
84
83
  const INITIALIZE_STATE_SEQ_NUM = -1;
@@ -112,8 +111,7 @@ export async function createCallFactory(
112
111
  // The node id we are connecting to (or that connected to us)
113
112
  nodeId: string,
114
113
  // The node id that we were contacted on
115
- // NOTE: This used to default to empty string, which would be the case if we made the connection. But this caused problems when we want it to stop making two connections per server and reuse the connection if both the servers want it to talk to each other. I guess we can default it to our reconnection URL. I mean, how else are people going to connect to us other than that?
116
- localNodeId = ownReconnectionUrl || "",
114
+ localNodeId = "",
117
115
  ): Promise<CallFactory> {
118
116
  let niceConnectionName = nodeId;
119
117
 
@@ -560,24 +558,8 @@ export async function createCallFactory(
560
558
  if (call.isReturn) {
561
559
  if (!SocketFunction.LEGACY_INITIALIZE && call.seqNum === INITIALIZE_STATE_SEQ_NUM) {
562
560
  callFactory.receivedInitializeState = call.result as InitializeState;
563
- let otherReconnectionUrl = callFactory.receivedInitializeState.ownReconnectionUrl;
564
- callFactory.realNodeId = otherReconnectionUrl;
565
561
  if (SocketFunction.logMessages) {
566
- console.log(green(`Received initialize state from ${callFactory.realNodeId} at ${Date.now()}`));
567
- }
568
- if (otherReconnectionUrl && !canReconnect && !!getNodeIdLocation(otherReconnectionUrl) && otherReconnectionUrl !== ownReconnectionUrl) {
569
- if (changeNodeId({
570
- originalNodeId: nodeId,
571
- newNodeId: otherReconnectionUrl,
572
- callFactory,
573
- })) {
574
- nodeId = otherReconnectionUrl;
575
- niceConnectionName = otherReconnectionUrl;
576
- callerContext.nodeId = nodeId;
577
- canReconnect = !!getNodeIdLocation(nodeId);
578
- callFactory.nodeId = nodeId;
579
- callFactory.connectionId = { nodeId };
580
- }
562
+ console.log(green(`Received initialize state from ${callFactory.realNodeId} (for ${nodeId}) at ${Date.now()}`));
581
563
  }
582
564
  return;
583
565
  }
@@ -791,7 +773,6 @@ export async function createCallFactory(
791
773
  if (!SocketFunction.LEGACY_INITIALIZE) {
792
774
  let initState: InitializeState = {
793
775
  supportsLZ4: true,
794
- ownReconnectionUrl,
795
776
  };
796
777
  let initReturn: InternalReturnType = {
797
778
  isReturn: true,
@@ -811,11 +792,6 @@ export async function createCallFactory(
811
792
  return callFactory;
812
793
  }
813
794
 
814
- let ownReconnectionUrl: string | undefined;
815
- export function registerOwnReconnectionUrl(url: string) {
816
- ownReconnectionUrl = url;
817
- }
818
-
819
795
 
820
796
  let uncompressedSent = 0;
821
797
  let compressedSent = 0;
@@ -5,7 +5,7 @@ import tls from "tls";
5
5
  import { getNodeIdsFromRequest, httpCallHandler } from "./callHTTPHandler";
6
6
  import { SocketFunction } from "../SocketFunction";
7
7
  import { getTrustedCertificates, watchTrustedCertificates } from "./certStore";
8
- import { createCallFactory, registerOwnReconnectionUrl } from "./CallFactory";
8
+ import { createCallFactory } from "./CallFactory";
9
9
  import { parseSNIExtension, parseTLSHello, SNIType } from "./tlsParsing";
10
10
  import debugbreak from "debugbreak";
11
11
  import { getNodeId } from "./nodeCache";
@@ -351,7 +351,6 @@ export async function startSocketServer(
351
351
 
352
352
  let nodeId = getNodeId(getCommonName(config.cert), port);
353
353
  console.log(green(`Started Listening on ${nodeId} (${host}) after ${formatTime(process.uptime() * 1000)}`));
354
- registerOwnReconnectionUrl(nodeId);
355
354
 
356
355
  return nodeId;
357
356
  }