Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/network-protocol/FS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ bool NetworkProtocolFS::open_file()

if (aux1_open == 4 || aux1_open == 8)
resolve();
else
stat();

update_dir_filename(opened_url);

Expand Down Expand Up @@ -182,6 +184,8 @@ bool NetworkProtocolFS::read(unsigned short len)
{
bool ret;

is_write = false;

switch (openMode)
{
case FILE:
Expand Down Expand Up @@ -245,6 +249,7 @@ bool NetworkProtocolFS::read_dir(unsigned short len)

bool NetworkProtocolFS::write(unsigned short len)
{
is_write = true;
len = translate_transmit_buffer();
return write_file(len); // Do more here? not sure.
}
Expand Down Expand Up @@ -285,7 +290,10 @@ bool NetworkProtocolFS::status_file(NetworkStatus *status)
#endif

status->connected = fileSize > 0 ? 1 : 0;
status->error = fileSize > 0 ? error : NETWORK_ERROR_END_OF_FILE;
if (is_write)
status->error = 1;
else
status->error = fileSize > 0 ? error : NETWORK_ERROR_END_OF_FILE;

NetworkProtocol::status(status);

Expand Down
2 changes: 1 addition & 1 deletion lib/network-protocol/Protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ bool NetworkProtocol::write(unsigned short len)
*/
bool NetworkProtocol::status(NetworkStatus *status)
{
if (receiveBuffer->length() == 0 && status->rxBytesWaiting > 0)
if (!is_write && receiveBuffer->length() == 0 && status->rxBytesWaiting > 0)
read(status->rxBytesWaiting);

status->rxBytesWaiting = receiveBuffer->length();
Expand Down
6 changes: 5 additions & 1 deletion lib/network-protocol/Protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ class NetworkProtocol
{
public:
std::string name = "UNKNOWN";

/**
* Was the last command a write?
*/
bool is_write = false;

/**
* Pointer to the receive buffer
*/
Expand Down
Loading