Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Roy Razon committed Sep 11, 2023
1 parent 4547ca8 commit c183d65
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tunnel-server/src/tunnel-store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ export type ActiveTunnelStore = {
delete: (key: string, tx?: TransactionDescriptor) => Promise<void>
}

const txIdGenerator = () => {
let nextTxId = 0
const idGenerator = () => {
let nextId = 0
return {
next: () => {
const result = nextTxId
nextTxId += 1
const result = nextId
nextId += 1
return result
},
}
Expand All @@ -53,7 +53,7 @@ const txIdGenerator = () => {
export const inMemoryActiveTunnelStore = ({ log }: { log: Logger }): ActiveTunnelStore => {
const keyToTunnel = new Map<string, ActiveTunnel & { txId: number }>()
const pkThumbprintToTunnel = arrayMap<string, ActiveTunnel>()
const txIdGen = txIdGenerator()
const txIdGen = idGenerator()
return {
get: async key => keyToTunnel.get(key),
getByPkThumbprint: async pkThumbprint => pkThumbprintToTunnel.get(pkThumbprint),
Expand All @@ -62,7 +62,7 @@ export const inMemoryActiveTunnelStore = ({ log }: { log: Logger }): ActiveTunne
throw new KeyAlreadyExistsError(key)
}
const txId = txIdGen.next()
log.debug('setting tunnel %s: %j', key, txId, value)
log.debug('setting tunnel key %s id %s: %j', key, txId, value)
keyToTunnel.set(key, Object.assign(value, { txId }))
pkThumbprintToTunnel.add(value.publicKeyThumbprint, value)
return { txId }
Expand Down

0 comments on commit c183d65

Please sign in to comment.