|
Lines 88-94
sftpio(void *_bwlimit, size_t amount)
Link Here
|
| 88 |
{ |
88 |
{ |
| 89 |
struct bwlimit *bwlimit = (struct bwlimit *)_bwlimit; |
89 |
struct bwlimit *bwlimit = (struct bwlimit *)_bwlimit; |
| 90 |
|
90 |
|
| 91 |
bandwidth_limit(bwlimit, amount); |
91 |
refresh_progress_meter(); |
|
|
92 |
if (bwlimit != NULL) |
| 93 |
bandwidth_limit(bwlimit, amount); |
| 92 |
return 0; |
94 |
return 0; |
| 93 |
} |
95 |
} |
| 94 |
|
96 |
|
|
Lines 108-115
send_msg(struct sftp_conn *conn, struct sshbuf *m)
Link Here
|
| 108 |
iov[1].iov_base = (u_char *)sshbuf_ptr(m); |
110 |
iov[1].iov_base = (u_char *)sshbuf_ptr(m); |
| 109 |
iov[1].iov_len = sshbuf_len(m); |
111 |
iov[1].iov_len = sshbuf_len(m); |
| 110 |
|
112 |
|
| 111 |
if (atomiciov6(writev, conn->fd_out, iov, 2, |
113 |
if (atomiciov6(writev, conn->fd_out, iov, 2, sftpio, |
| 112 |
conn->limit_kbps > 0 ? sftpio : NULL, &conn->bwlimit_out) != |
114 |
conn->limit_kbps > 0 ? &conn->bwlimit_out : NULL) != |
| 113 |
sshbuf_len(m) + sizeof(mlen)) |
115 |
sshbuf_len(m) + sizeof(mlen)) |
| 114 |
fatal("Couldn't send packet: %s", strerror(errno)); |
116 |
fatal("Couldn't send packet: %s", strerror(errno)); |
| 115 |
|
117 |
|
|
Lines 125-132
get_msg_extended(struct sftp_conn *conn, struct sshbuf *m, int initial)
Link Here
|
| 125 |
|
127 |
|
| 126 |
if ((r = sshbuf_reserve(m, 4, &p)) != 0) |
128 |
if ((r = sshbuf_reserve(m, 4, &p)) != 0) |
| 127 |
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
129 |
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
| 128 |
if (atomicio6(read, conn->fd_in, p, 4, |
130 |
if (atomicio6(read, conn->fd_in, p, 4, sftpio, |
| 129 |
conn->limit_kbps > 0 ? sftpio : NULL, &conn->bwlimit_in) != 4) { |
131 |
conn->limit_kbps > 0 ? &conn->bwlimit_in : NULL) != 4) { |
| 130 |
if (errno == EPIPE || errno == ECONNRESET) |
132 |
if (errno == EPIPE || errno == ECONNRESET) |
| 131 |
fatal("Connection closed"); |
133 |
fatal("Connection closed"); |
| 132 |
else |
134 |
else |
|
Lines 144-151
get_msg_extended(struct sftp_conn *conn, struct sshbuf *m, int initial)
Link Here
|
| 144 |
|
146 |
|
| 145 |
if ((r = sshbuf_reserve(m, msg_len, &p)) != 0) |
147 |
if ((r = sshbuf_reserve(m, msg_len, &p)) != 0) |
| 146 |
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
148 |
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
| 147 |
if (atomicio6(read, conn->fd_in, p, msg_len, |
149 |
if (atomicio6(read, conn->fd_in, p, msg_len, sftpio, |
| 148 |
conn->limit_kbps > 0 ? sftpio : NULL, &conn->bwlimit_in) |
150 |
conn->limit_kbps > 0 ? &conn->bwlimit_in : NULL) |
| 149 |
!= msg_len) { |
151 |
!= msg_len) { |
| 150 |
if (errno == EPIPE) |
152 |
if (errno == EPIPE) |
| 151 |
fatal("Connection closed"); |
153 |
fatal("Connection closed"); |