Skip to content

Commit

Permalink
fix: allow multiple connections via .startLocalProxy socket (#366)
Browse files Browse the repository at this point in the history
The .startLocalProxy method of starting a local Unix socket
to connect over used .once which was an oversight. This only
allows a single connection via the socket. For a connection pool
to leverage several connections at once we should use .on.

Tested using Prisma's connection_limit query argument.
Using .once only works with connection_limit=1 while using
.on allows for connection_limit=2 etc.
  • Loading branch information
jackwotherspoon authored Jun 21, 2024
1 parent 9f3381b commit cce7aad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ export class Connector {
console.error(err);
});

// Once a connection is stablished, pipe data from the
// When a connection is established, pipe data from the
// local proxy server to the secure TCP Socket and vice-versa.
server.once('connection', c => {
server.on('connection', c => {
const s = stream();
this.sockets.add(s);
this.sockets.add(c);
Expand Down

0 comments on commit cce7aad

Please sign in to comment.