Skip to content

Commit 82a1310

Browse files
committed
pause/resume socket
1 parent 7a0bb68 commit 82a1310

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/pg-gateway/src/auth/sasl/scram-sha-256.ts

+4
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,12 @@ export class ScramSha256AuthFlow extends SaslMechanism implements AuthFlow {
159159
*/
160160
async getScramSha256Data(params: { username: string }) {
161161
if (!this.scramSha256Data) {
162+
this.socket.pause();
162163
this.scramSha256Data = await this.auth.getScramSha256Data(
163164
params,
164165
this.connectionState,
165166
);
167+
this.socket.resume();
166168
}
167169
return this.scramSha256Data;
168170
}
@@ -278,6 +280,7 @@ export class ScramSha256AuthFlow extends SaslMechanism implements AuthFlow {
278280
username: this.username,
279281
});
280282

283+
this.socket.pause();
281284
const isValid = await this.auth.validateCredentials(
282285
{
283286
authMessage,
@@ -287,6 +290,7 @@ export class ScramSha256AuthFlow extends SaslMechanism implements AuthFlow {
287290
},
288291
this.connectionState,
289292
);
293+
this.socket.resume();
290294

291295
if (!isValid) {
292296
throw new Error('Invalid credentials');

0 commit comments

Comments
 (0)