🐞 fix(ftp): 修改代码错误

添加被删除的消息处理
This commit is contained in:
huheng@kylinos.cn 2022-10-26 14:04:30 +08:00
parent f26b499bf5
commit a8e693eb59
1 changed files with 8 additions and 6 deletions

View File

@ -347,12 +347,6 @@ void FtpSession::handleFtpCommandPASV(const std::string & /*param*/)
auto ip_bytes = command_socket_.local_endpoint().address().to_v4().to_bytes();
auto port = data_acceptor_.local_endpoint().port();
// Form reply string
std::stringstream stream;
stream << "(";
for (size_t i = 0; i < 4; i++) {
stream << static_cast<int>(ip_bytes[i]) << ",";
}
std::ifstream file;
file.open(DEVICEID_FILE_LOACLPATH, std::ios_base::in);
@ -370,6 +364,14 @@ void FtpSession::handleFtpCommandPASV(const std::string & /*param*/)
}
file.close();
// Form reply string
std::stringstream stream;
stream << "(";
for (size_t i = 0; i < 4; i++) {
stream << static_cast<int>(ip_bytes[i]) << ",";
}
stream << ((port >> 8) & 0xff) << "," << (port & 0xff) << ")";
sendFtpMessage(FtpReplyCode::ENTERING_PASSIVE_MODE, "Entering passive mode " + stream.str());
return;
} // namespace fineftp