Skip to content

Commit

Permalink
Added note to handle backpressure
Browse files Browse the repository at this point in the history
  • Loading branch information
PantelisGeorgiadis committed Feb 26, 2024
1 parent ee90f7b commit 5e0e9e7
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/Network.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,19 +509,6 @@ class Network extends AsyncEventEmitter {
}
}

/**
* Write PDV data to stream while handling backpressure.
* @method
* @private
* @param {Writable} stream - The store writable stream.
* @param {PDataTF} pdu - PDU.
*/
_writePdvToStream(stream, pdv) {
if (!stream.write(pdv.getValue())) {
stream.once('drain', () => this._writePdvToStream(stream, pdv));
}
}

/**
* Process P-DATA-TF.
* @method
Expand Down Expand Up @@ -561,7 +548,9 @@ class Network extends AsyncEventEmitter {
}

const stream = this.dimseStream || this.dimseStoreStream;
this._writePdvToStream(stream, pdv);

// TODO: Add stream backpressure event handling
stream.write(pdv.getValue());

if (pdv.isLastFragment()) {
if (pdv.isCommand()) {
Expand Down

0 comments on commit 5e0e9e7

Please sign in to comment.