Skip to content

Commit 293de80

Browse files
committed
[network-protocol] do not emit EOF on write.
1 parent 2539fb8 commit 293de80

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

lib/network-protocol/FS.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ bool NetworkProtocolFS::open_file()
5858

5959
if (aux1_open == 4 || aux1_open == 8)
6060
resolve();
61+
else
62+
stat();
6163

6264
update_dir_filename(opened_url);
6365

@@ -182,6 +184,8 @@ bool NetworkProtocolFS::read(unsigned short len)
182184
{
183185
bool ret;
184186

187+
is_write = false;
188+
185189
switch (openMode)
186190
{
187191
case FILE:
@@ -245,6 +249,7 @@ bool NetworkProtocolFS::read_dir(unsigned short len)
245249

246250
bool NetworkProtocolFS::write(unsigned short len)
247251
{
252+
is_write = true;
248253
len = translate_transmit_buffer();
249254
return write_file(len); // Do more here? not sure.
250255
}
@@ -285,7 +290,10 @@ bool NetworkProtocolFS::status_file(NetworkStatus *status)
285290
#endif
286291

287292
status->connected = fileSize > 0 ? 1 : 0;
288-
status->error = fileSize > 0 ? error : NETWORK_ERROR_END_OF_FILE;
293+
if (is_write)
294+
status->error = 1;
295+
else
296+
status->error = fileSize > 0 ? error : NETWORK_ERROR_END_OF_FILE;
289297

290298
NetworkProtocol::status(status);
291299

lib/network-protocol/Protocol.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ bool NetworkProtocol::write(unsigned short len)
181181
*/
182182
bool NetworkProtocol::status(NetworkStatus *status)
183183
{
184-
if (receiveBuffer->length() == 0 && status->rxBytesWaiting > 0)
184+
if (!is_write && receiveBuffer->length() == 0 && status->rxBytesWaiting > 0)
185185
read(status->rxBytesWaiting);
186186

187187
status->rxBytesWaiting = receiveBuffer->length();

lib/network-protocol/Protocol.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ class NetworkProtocol
1111
{
1212
public:
1313
std::string name = "UNKNOWN";
14-
14+
/**
15+
* Was the last command a write?
16+
*/
17+
bool is_write = false;
18+
1519
/**
1620
* Pointer to the receive buffer
1721
*/

0 commit comments

Comments
 (0)