diff --git a/net_services/CXM_generic_protocol.anubis b/net_services/CXM_generic_protocol.anubis index c4ffe32..9f6540c 100644 --- a/net_services/CXM_generic_protocol.anubis +++ b/net_services/CXM_generic_protocol.anubis @@ -202,7 +202,7 @@ public define Bool forget(add_message(msg, "GET_FILE_REF", to_Message(f_ref))); forget(mQ.add_Message_to_send(msg)); - if wait_for_reply(mQ, _CXM_GET_FILE_REF, 10) is + if wait_for_reply(mQ, _CXM_GET_FILE_REF, 30) is { failure then false, timeout then false, @@ -211,7 +211,7 @@ public define Bool error(_, _) then false, ok then false, //false because OK without result message is not allowed ok_msg(rmsg) then - with size = if find_int64(rmsg, "SIZE") is {failure then f_ref.size, success(i64) then to_Int([i64])}, + 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_}}, with mode = find_string(rmsg, "MODE", "NEW"), if mode = "APPEND" then if (Maybe(RWStream))file(target_file, append) is @@ -244,37 +244,44 @@ public define Bool MessageQueue mQ, Message msg, )= - println("NET_SERVICE send_file_ref received"); + println("NET_SERVICE send_file_ref received *"); if *msg.what = _CXM_GET_FILE_REF then if find_message(msg, "GET_FILE_REF") is { - failure then println("NET_SERVICE send_file_ref: can't find GET_FILE_REF message"); false + failure then println("NET_SERVICE send_file_ref: can't find GET_FILE_REF message"); false, success(file_ref_obj_msg) then + println("NET_SERVICE send_file_ref: GET_FILE_REF message found"); if (Maybe(File_ref))from_Message(file_ref_obj_msg) is { failure then println("NET_SERVICE send_file_ref: can't extract GET_FILE_REF message");false, success(f_ref) then - + println("NET_SERVICE send_file_ref: GET_FILE_REF message File_ref extracted\n"+dump(file_ref_obj_msg)); //create the target with source_file = f_ref.path + "/" + f_ref.name, with msg = message(0), with size = file_size(source_file), - + + println("source_file = "+source_file); + println("size = "+size); forget(add_string(msg, "MODE", "NEW")); - forget(add_int64(msg, "SIZE", to_Word64(size))); - + println("add MODE ok"); + forget(add_string(msg, "SIZE", to_String(size))); + println("add SIZE ok"); + println("NET_SERVICE send_file_ref: reply message \n"+dump(msg)); if (Maybe(RStream))file(source_file, read) is { failure then println("NET_SERVICE send_file_ref: can't open source file"+source_file);false, //nothing to write - success(source) then + success(source) then + println("NET_SERVICE send_file_ref send ack file size "+size); send_ACK_ok(mQ, _CXM_GET_FILE_REF, msg); if copy_file_to_Connection(file(source), mQ.get_connection(unique), size) is { - failure then false, - success(_) then true + failure then println("NET_SERVICE send_file_ref copy_file_to_Connection error");false, + success(_) then println("NET_SERVICE send_file_ref copy_file_to_Connection ok");true } } } } else //not _CXM_GET_FILE_REF + println("[send_file_ref] it's not a _CXM_GET_FILE_REF"); false . -- libgit2 0.21.4