Revert "meshdevicefile: only pause source socket when HTTP write buffer fills (#7816)"

This reverts commit a1c5eb715f866379fe8c6b4807220fd1c94ea5e3.

Simon Smith committed May 23, 2026 at 09:18 UTC 1790154b533db4341d44a715a8f974986d79094f
1 file changed +4 -12
meshdevicefile.js
+4 -12
@@ -224,18 +224,10 @@ module.exports.CreateMeshDeviceFile = function (parent, ws, res, req, domain, us
224 }
225 }
226 } else {
227 - // Only apply backpressure when the HTTP write buffer actually fills,
228 - // instead of pausing/resuming the source socket on every chunk.
229 - // The previous unconditional pause+resume per chunk forced stop-and-wait
230 - // on every frame, capping device file download throughput around 2 Mbit/s
231 - // for any client whose RTT to the server is non-trivial.
232 - try {
233 - if (this.res.write(data) === false) {
234 - var sock = this._socket;
235 - sock.pause();
236 - this.res.once('drain', function () { try { sock.resume(); } catch (ex) { } });
237 - }
238 - } catch (ex) { }
227 + var unpause = function unpauseFunc(err) { try { unpauseFunc.s.resume(); } catch (ex) { } }
228 + unpause.s = this._socket;
229 + this._socket.pause();
230 + try { this.res.write(data, unpause); } catch (ex) { }
231 }
232 });
233