Software /
code /
prosody
Comparison
plugins/mod_proxy65.lua @ 2308:600ac8992a4c
mod_proxy65: Only lock the reading side when throttling
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> |
---|---|
date | Thu, 03 Dec 2009 17:02:38 +0100 |
parent | 2306:21f0d80f244a |
child | 2309:7dc6049a69e8 |
comparison
equal
deleted
inserted
replaced
2307:fc7e0962520a | 2308:600ac8992a4c |
---|---|
260 local sender_locked; | 260 local sender_locked; |
261 local _sendbuffer = receiver.sendbuffer; | 261 local _sendbuffer = receiver.sendbuffer; |
262 function receiver.sendbuffer() | 262 function receiver.sendbuffer() |
263 _sendbuffer(); | 263 _sendbuffer(); |
264 if sender_locked and receiver.bufferlen() < sender_lock_threshold then | 264 if sender_locked and receiver.bufferlen() < sender_lock_threshold then |
265 sender:lock(false); -- Unlock now | 265 sender:lock_read(false); -- Unlock now |
266 sender_locked = nil; | 266 sender_locked = nil; |
267 end | 267 end |
268 end | 268 end |
269 | 269 |
270 local _readbuffer = sender.readbuffer; | 270 local _readbuffer = sender.readbuffer; |
271 function sender.readbuffer() | 271 function sender.readbuffer() |
272 _readbuffer(); | 272 _readbuffer(); |
273 if not sender_locked and receiver.bufferlen() >= sender_lock_threshold then | 273 if not sender_locked and receiver.bufferlen() >= sender_lock_threshold then |
274 sender_locked = true; | 274 sender_locked = true; |
275 sender:lock(true); | 275 sender:lock_read(true); |
276 end | 276 end |
277 end | 277 end |
278 end | 278 end |