From a0978968b8c6fd15d99d585a30d33b1932979ee7 Mon Sep 17 00:00:00 2001 From: Oliver Winks Date: Mon, 4 Jul 2022 14:29:39 +0100 Subject: [PATCH] attempted fix of port number issue --- local/package.json | 2 +- local/packages/main/flows/udp/udpSink.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/local/package.json b/local/package.json index 6a59079..b3fb7a0 100644 --- a/local/package.json +++ b/local/package.json @@ -1,6 +1,6 @@ { "name": "local", - "version": "2.1.0", + "version": "2.1.1", "main": "dist/main/index.cjs", "author": "草鞋没号 <308487730@qq.com>", "license": "MIT", diff --git a/local/packages/main/flows/udp/udpSink.ts b/local/packages/main/flows/udp/udpSink.ts index 797644e..1b3ddb8 100644 --- a/local/packages/main/flows/udp/udpSink.ts +++ b/local/packages/main/flows/udp/udpSink.ts @@ -4,7 +4,7 @@ import { observerToUdp } from "../../rxadapters/rxUdp"; import { useUdpSocket } from "./useUdpSocket"; const sendingSockets: dgram.Socket[] = []; -let nextPort = 5001; +let nextPort = 5000; export interface UdpSinkOptions { name: string; @@ -50,7 +50,7 @@ export function udpSink(options: UdpSinkOptions): Promise { // create a new observer from the socket to observe the source const toAddress = options.toAddress ?? "127.0.0.1"; - const toPort = options.toPort ?? nextPort++; + const toPort = options.toPort ?? existingSocket ? nextPort : ++nextPort; return socket .then((socket) => observerToUdp(toAddress, toPort, socket, options.sender, options.debug)) .then((observer) => {