Commit a927281b3b9931efaeea4382191f7170944ec663
1 parent
aab167ad
still debugging
Showing
1 changed file
with
18 additions
and
11 deletions
Show diff stats
net_services/CXM_generic_protocol.anubis
| @@ -202,7 +202,7 @@ public define Bool | @@ -202,7 +202,7 @@ public define Bool | ||
| 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)); |
| 204 | 204 | ||
| 205 | - if wait_for_reply(mQ, _CXM_GET_FILE_REF, 10) is | 205 | + if wait_for_reply(mQ, _CXM_GET_FILE_REF, 30) is |
| 206 | { | 206 | { |
| 207 | failure then false, | 207 | failure then false, |
| 208 | timeout then false, | 208 | timeout then false, |
| @@ -211,7 +211,7 @@ public define Bool | @@ -211,7 +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 | - with size = if find_int64(rmsg, "SIZE") is {failure then f_ref.size, success(i64) then to_Int([i64])}, | 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 mode = find_string(rmsg, "MODE", "NEW"), | 215 | with mode = find_string(rmsg, "MODE", "NEW"), |
| 216 | if mode = "APPEND" then | 216 | if mode = "APPEND" then |
| 217 | if (Maybe(RWStream))file(target_file, append) is | 217 | if (Maybe(RWStream))file(target_file, append) is |
| @@ -244,37 +244,44 @@ public define Bool | @@ -244,37 +244,44 @@ public define Bool | ||
| 244 | MessageQueue mQ, | 244 | MessageQueue mQ, |
| 245 | Message msg, | 245 | Message msg, |
| 246 | )= | 246 | )= |
| 247 | - println("NET_SERVICE send_file_ref received"); | 247 | + println("NET_SERVICE send_file_ref received *"); |
| 248 | if *msg.what = _CXM_GET_FILE_REF then | 248 | if *msg.what = _CXM_GET_FILE_REF then |
| 249 | if find_message(msg, "GET_FILE_REF") is { | 249 | if find_message(msg, "GET_FILE_REF") is { |
| 250 | - failure then println("NET_SERVICE send_file_ref: can't find GET_FILE_REF message"); false | 250 | + failure then println("NET_SERVICE send_file_ref: can't find GET_FILE_REF message"); false, |
| 251 | success(file_ref_obj_msg) then | 251 | success(file_ref_obj_msg) then |
| 252 | + println("NET_SERVICE send_file_ref: GET_FILE_REF message found"); | ||
| 252 | if (Maybe(File_ref))from_Message(file_ref_obj_msg) is | 253 | if (Maybe(File_ref))from_Message(file_ref_obj_msg) is |
| 253 | { | 254 | { |
| 254 | failure then println("NET_SERVICE send_file_ref: can't extract GET_FILE_REF message");false, | 255 | failure then println("NET_SERVICE send_file_ref: can't extract GET_FILE_REF message");false, |
| 255 | success(f_ref) then | 256 | success(f_ref) then |
| 256 | - | 257 | + println("NET_SERVICE send_file_ref: GET_FILE_REF message File_ref extracted\n"+dump(file_ref_obj_msg)); |
| 257 | //create the target | 258 | //create the target |
| 258 | with source_file = f_ref.path + "/" + f_ref.name, | 259 | with source_file = f_ref.path + "/" + f_ref.name, |
| 259 | with msg = message(0), | 260 | with msg = message(0), |
| 260 | with size = file_size(source_file), | 261 | with size = file_size(source_file), |
| 261 | - | 262 | + |
| 263 | + println("source_file = "+source_file); | ||
| 264 | + println("size = "+size); | ||
| 262 | forget(add_string(msg, "MODE", "NEW")); | 265 | forget(add_string(msg, "MODE", "NEW")); |
| 263 | - forget(add_int64(msg, "SIZE", to_Word64(size))); | ||
| 264 | - | 266 | + println("add MODE ok"); |
| 267 | + forget(add_string(msg, "SIZE", to_String(size))); | ||
| 268 | + println("add SIZE ok"); | ||
| 269 | + println("NET_SERVICE send_file_ref: reply message \n"+dump(msg)); | ||
| 265 | if (Maybe(RStream))file(source_file, read) is | 270 | if (Maybe(RStream))file(source_file, read) is |
| 266 | { | 271 | { |
| 267 | failure then println("NET_SERVICE send_file_ref: can't open source file"+source_file);false, //nothing to write | 272 | failure then println("NET_SERVICE send_file_ref: can't open source file"+source_file);false, //nothing to write |
| 268 | - success(source) then | 273 | + success(source) then |
| 274 | + println("NET_SERVICE send_file_ref send ack file size "+size); | ||
| 269 | send_ACK_ok(mQ, _CXM_GET_FILE_REF, msg); | 275 | send_ACK_ok(mQ, _CXM_GET_FILE_REF, msg); |
| 270 | if copy_file_to_Connection(file(source), mQ.get_connection(unique), size) is | 276 | if copy_file_to_Connection(file(source), mQ.get_connection(unique), size) is |
| 271 | { | 277 | { |
| 272 | - failure then false, | ||
| 273 | - success(_) then true | 278 | + failure then println("NET_SERVICE send_file_ref copy_file_to_Connection error");false, |
| 279 | + success(_) then println("NET_SERVICE send_file_ref copy_file_to_Connection ok");true | ||
| 274 | } | 280 | } |
| 275 | } | 281 | } |
| 276 | } | 282 | } |
| 277 | } | 283 | } |
| 278 | else //not _CXM_GET_FILE_REF | 284 | else //not _CXM_GET_FILE_REF |
| 285 | + println("[send_file_ref] it's not a _CXM_GET_FILE_REF"); | ||
| 279 | false | 286 | false |
| 280 | . | 287 | . |