Small fixes
This commit is contained in:
parent
006fd6ebec
commit
6e1323cc23
@ -637,6 +637,12 @@ void LocalFileTransfer::callback_transfer_network_write(int fd, short events, vo
|
||||
assert(buffer->offset < buffer->length);
|
||||
auto written = ::send(fd, buffer->data + buffer->offset, std::min(buffer->length - buffer->offset, max_write_bytes), MSG_DONTWAIT | MSG_NOSIGNAL);
|
||||
if(written <= 0) {
|
||||
if(transfer->state != FileClient::STATE_TRANSFERRING) {
|
||||
std::unique_lock slock{transfer->state_mutex};
|
||||
transfer->handle->disconnect_client(transfer->shared_from_this(), slock, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if(written == 0) {
|
||||
/* EOF, how the hell is this event possible?! (Read should already catch it) */
|
||||
logError(LOG_FT, "{} Client disconnected unexpectedly on write. Send {} bytes out of {}.",
|
||||
@ -645,7 +651,7 @@ void LocalFileTransfer::callback_transfer_network_write(int fd, short events, vo
|
||||
transfer->handle->invoke_aborted_callback(transfer->shared_from_this(), { TransferError::UNEXPECTED_CLIENT_DISCONNECT, "" });
|
||||
{
|
||||
std::unique_lock slock{transfer->state_mutex};
|
||||
transfer->handle->disconnect_client(transfer->shared_from_this(), slock, true);
|
||||
transfer->handle->disconnect_client(transfer->shared_from_this(), slock, false);
|
||||
}
|
||||
} else {
|
||||
if(errno == EAGAIN) {
|
||||
@ -800,7 +806,7 @@ size_t LocalFileTransfer::handle_transfer_read_raw(const std::shared_ptr<FileCli
|
||||
logMessage(LOG_FT, "{} Successfully initialized file download for file {}.", client->log_prefix(), client->transfer->absolute_file_path);
|
||||
this->enqueue_disk_io(client); /* we've to take initiative */
|
||||
} else {
|
||||
logMessage(LOG_FT, "{} Successfully upload file download to file {}.", client->log_prefix(), client->transfer->absolute_file_path);
|
||||
logMessage(LOG_FT, "{} Successfully initialized file upload to file {}.", client->log_prefix(), client->transfer->absolute_file_path);
|
||||
}
|
||||
|
||||
return length ? this->handle_transfer_read(client, buffer, length) : 0;
|
||||
@ -1146,7 +1152,7 @@ TransferUploadRawResult LocalFileTransfer::handle_transfer_upload_raw(const std:
|
||||
if(write_offset + write_length > client->transfer->expected_file_size) {
|
||||
result = TransferUploadRawResult::FINISH_OVERFLOW;
|
||||
write_length = client->transfer->expected_file_size - write_offset;
|
||||
} else if(write_offset == client->transfer->expected_file_size) {
|
||||
} else if(write_offset + write_length == client->transfer->expected_file_size) {
|
||||
result = TransferUploadRawResult::FINISH;
|
||||
}
|
||||
|
||||
|
@ -619,7 +619,7 @@ command_result ConnectedClient::handleCommandFTInitUpload(ts::Command &cmd) {
|
||||
info.file_offset = 0;
|
||||
info.expected_file_size = cmd["size"].as<size_t>();
|
||||
info.override_exiting = cmd["overwrite"].as<bool>();
|
||||
info.file_path = cmd["name"].string();
|
||||
info.file_path = cmd["path"].string() + "/" + cmd["name"].string();
|
||||
info.client_unique_id = this->getUid();
|
||||
info.client_id = this->getClientId();
|
||||
info.max_concurrent_transfers = kMaxClientTransfers;
|
||||
|
Loading…
Reference in New Issue
Block a user