Commit 221f3006 authored by Guillaume Roguez's avatar Guillaume Roguez

data tx: fix GO msg

GO message was send at every "incoming-read" loop.
Only one msg is needed.

Change-Id: I11a808eced6c08a9e76e9615d2218c43710f7546
parent c14b731d
...@@ -70,6 +70,8 @@ FtpServer::startNewFile() ...@@ -70,6 +70,8 @@ FtpServer::startNewFile()
if (!out_) { if (!out_) {
RING_DBG() << "[FTP] transfer aborted by client"; RING_DBG() << "[FTP] transfer aborted by client";
closed_ = true; // send NOK msg at next read() closed_ = true; // send NOK msg at next read()
} else {
go_ = true;
} }
return bool(out_); return bool(out_);
} }
...@@ -96,11 +98,12 @@ FtpServer::read(std::vector<uint8_t>& buffer) const ...@@ -96,11 +98,12 @@ FtpServer::read(std::vector<uint8_t>& buffer) const
} else { } else {
buffer.resize(0); buffer.resize(0);
} }
return true; } else if (go_) {
go_ = false;
buffer.resize(3);
buffer[0] = 'G'; buffer[1] = 'O'; buffer[2] = '\n';
RING_DBG() << "[FTP] sending GO order";
} }
buffer.resize(3);
buffer[0] = 'G'; buffer[1] = 'O'; buffer[2] = '\n';
RING_DBG() << "[FTP] sending GO order";
return true; return true;
} }
......
...@@ -60,6 +60,7 @@ private: ...@@ -60,6 +60,7 @@ private:
std::string displayName_; std::string displayName_;
std::array<char, 1000> line_; std::array<char, 1000> line_;
mutable bool closed_ {false}; mutable bool closed_ {false};
mutable bool go_ {false};
FtpState state_ {FtpState::PARSE_HEADERS}; FtpState state_ {FtpState::PARSE_HEADERS};
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment