Commit 0afc61c9e61d62d57225860458aecd78190d9e44
1 parent
27bccd14
remove some debug comment and manage the raw_mode
Showing
1 changed file
with
9 additions
and
4 deletions
Show diff stats
net_services/CXM_generic_protocol.anubis
| @@ -197,7 +197,7 @@ public define Bool | @@ -197,7 +197,7 @@ public define Bool | ||
| 197 | )= | 197 | )= |
| 198 | //create the target | 198 | //create the target |
| 199 | with target_file = tmp_path + "/" + f_ref.name, | 199 | with target_file = tmp_path + "/" + f_ref.name, |
| 200 | - println("NET_SERVICE get_file_ref for "+target_file); | 200 | + //println("NET_SERVICE get_file_ref for "+target_file); |
| 201 | with msg = message(_CXM_GET_FILE_REF), | 201 | with msg = message(_CXM_GET_FILE_REF), |
| 202 | forget(add_message(msg, "GET_FILE_REF", to_Message(f_ref))); | 202 | forget(add_message(msg, "GET_FILE_REF", to_Message(f_ref))); |
| 203 | forget(mQ.add_Message_to_send(msg)); | 203 | forget(mQ.add_Message_to_send(msg)); |
| @@ -211,6 +211,7 @@ public define Bool | @@ -211,6 +211,7 @@ public define Bool | ||
| 211 | error(_, _) then false, | 211 | error(_, _) then false, |
| 212 | ok then false, //false because OK without result message is not allowed | 212 | ok then false, //false because OK without result message is not allowed |
| 213 | ok_msg(rmsg) then | 213 | ok_msg(rmsg) then |
| 214 | + //println("get_file_ref wait_for_reply _CXM_GET_FILE_REF OK"); | ||
| 214 | with size = if find_string(rmsg, "SIZE") is {failure then f_ref.size, success(size_str) then if decimal_scan(size_str) is { failure then should_not_happen(0), success(_size_) then _size_}}, | 215 | with size = if find_string(rmsg, "SIZE") is {failure then f_ref.size, success(size_str) then if decimal_scan(size_str) is { failure then should_not_happen(0), success(_size_) then _size_}}, |
| 215 | with mode = find_string(rmsg, "MODE", "NEW"), | 216 | with mode = find_string(rmsg, "MODE", "NEW"), |
| 216 | if mode = "APPEND" then | 217 | if mode = "APPEND" then |
| @@ -219,6 +220,7 @@ public define Bool | @@ -219,6 +220,7 @@ public define Bool | ||
| 219 | failure then println("can't create target file"+target_file);false, //nothing to write | 220 | failure then println("can't create target file"+target_file);false, //nothing to write |
| 220 | success(target) then | 221 | success(target) then |
| 221 | with buffer = mQ.raw_mode_on(size), | 222 | with buffer = mQ.raw_mode_on(size), |
| 223 | + //println("raw_more on buffer len "+length(buffer)+" buffer ["+to_string(buffer)+"]"); | ||
| 222 | forget(flush(buffer, weaken(target))); | 224 | forget(flush(buffer, weaken(target))); |
| 223 | if copy_file_to_Connection(mQ.get_connection(unique), file(target), size - length(buffer)) is | 225 | if copy_file_to_Connection(mQ.get_connection(unique), file(target), size - length(buffer)) is |
| 224 | { | 226 | { |
| @@ -230,11 +232,14 @@ public define Bool | @@ -230,11 +232,14 @@ public define Bool | ||
| 230 | if (Maybe(RWStream))file(target_file, append) is | 232 | if (Maybe(RWStream))file(target_file, append) is |
| 231 | { | 233 | { |
| 232 | failure then println("can't create target file"+target_file);false, //nothing to write | 234 | failure then println("can't create target file"+target_file);false, //nothing to write |
| 233 | - success(target) then | 235 | + success(target) then |
| 236 | + with buffer = mQ.raw_mode_on(size), | ||
| 237 | + //println("raw_more on buffer len "+length(buffer)+" buffer ["+to_string(buffer)+"]"); | ||
| 238 | + forget(flush(buffer, weaken(target))); | ||
| 234 | if copy_file_to_Connection(mQ.get_connection(unique), file(target), size) is | 239 | if copy_file_to_Connection(mQ.get_connection(unique), file(target), size) is |
| 235 | { | 240 | { |
| 236 | - failure then false, | ||
| 237 | - success(_) then true | 241 | + failure then mQ.raw_mode_off(unique);false, |
| 242 | + success(_) then mQ.raw_mode_off(unique);true | ||
| 238 | } | 243 | } |
| 239 | } | 244 | } |
| 240 | } | 245 | } |