diff options
Diffstat (limited to 'daemon')
| -rw-r--r-- | daemon/device.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/daemon/device.c b/daemon/device.c index acedbdf..684e009 100644 --- a/daemon/device.c +++ b/daemon/device.c | |||
| @@ -322,7 +322,12 @@ int device_start_connect(int device_id, uint16_t dport, struct mux_client *clien | |||
| 322 | 322 | ||
| 323 | static void update_connection(struct mux_connection *conn) | 323 | static void update_connection(struct mux_connection *conn) |
| 324 | { | 324 | { |
| 325 | conn->sendable = conn->rx_win - (conn->tx_seq - conn->rx_ack); | 325 | uint32_t sent = conn->tx_seq - conn->rx_ack; |
| 326 | |||
| 327 | if(conn->rx_win > sent) | ||
| 328 | conn->sendable = conn->rx_win - sent; | ||
| 329 | else | ||
| 330 | conn->sendable = 0; | ||
| 326 | 331 | ||
| 327 | if(conn->sendable > conn->ob_capacity) | 332 | if(conn->sendable > conn->ob_capacity) |
| 328 | conn->sendable = conn->ob_capacity; | 333 | conn->sendable = conn->ob_capacity; |
