| 274 | callbacks.traffic(data.size, 0); |
| 275 | }, |
| 276 | inboundUnpacked(data) { |
| 277 | currentUnpacked += data.length; |
| 278 | |
| 279 | if (currentUnpacked >= currentReceived) { |
| 280 | currentUnpacked = 0; |
| 281 | currentReceived = 0; |
| 282 | } |
| 283 | |
| 284 | if (self.streamHandler !== null) { |
| 285 | if (streamPaused && !shouldPause()) { |
| 286 | streamPaused = false; |
| 287 | self.streamHandler.resume(); |
| 288 | |
| 289 | return; |
| 290 | } else if (!streamPaused && shouldPause()) { |
| 291 | streamPaused = true; |
| 292 | self.streamHandler.pause(); |
| 293 | |
| 294 | return; |
| 295 | } |
| 296 | } |
| 297 | }, |
| 298 | outbound(data) { |
| 299 | callbacks.traffic(0, data.length); |
| 300 | } |