Commit 71de788465f0bef8b5b44e3513c4d0f3b91d81dc
1 parent
027a26df
Add logger service constant.
Add send_result whitout any message. (just _CXM_OK will be send in _CXM_ACK message) remove some Trace print
Showing
3 changed files
with
30 additions
and
13 deletions
Show diff stats
calexium_lib/CXM_message_constants.anubis
| @@ -43,3 +43,8 @@ public define Int32 _CXM_FTP_GET_FILE = 0x33771402. | @@ -43,3 +43,8 @@ public define Int32 _CXM_FTP_GET_FILE = 0x33771402. | ||
| 43 | public define Int32 _CXM_FTP_START_TRANSFERT = 0x33771403. | 43 | public define Int32 _CXM_FTP_START_TRANSFERT = 0x33771403. |
| 44 | public define Int32 _CXM_FTP_DATA = 0x33771404. | 44 | public define Int32 _CXM_FTP_DATA = 0x33771404. |
| 45 | 45 | ||
| 46 | + // ************** LOGGER SERVICE ************** | ||
| 47 | + | ||
| 48 | +public define Int32 _CXM_LOGGER_SERVICE_MSG_BASIS = 0x33771800. // | ||
| 49 | +public define Int32 _CXM_LOGGER_SERVICE_ID = 0x33771801. | ||
| 50 | +public define Int32 _CXM_LOGGER_LOG = 0x33771802. |
calexium_lib/net_services/CXM_generic_protocol.anubis
| @@ -74,9 +74,20 @@ public define One | @@ -74,9 +74,20 @@ public define One | ||
| 74 | { | 74 | { |
| 75 | failure then send_ACK_error(queue, cmd_id), | 75 | failure then send_ACK_error(queue, cmd_id), |
| 76 | success(msg) then send_ACK_ok(queue, cmd_id, msg) | 76 | success(msg) then send_ACK_ok(queue, cmd_id, msg) |
| 77 | - } | ||
| 78 | - . | 77 | + }. |
| 79 | 78 | ||
| 79 | +public define One | ||
| 80 | + send_result | ||
| 81 | + ( | ||
| 82 | + MessageQueue queue, | ||
| 83 | + Int32 cmd_id, | ||
| 84 | + Bool result | ||
| 85 | + )= | ||
| 86 | + if result then | ||
| 87 | + send_ACK_ok(queue, cmd_id) | ||
| 88 | + else | ||
| 89 | + send_ACK_error(queue, cmd_id). | ||
| 90 | + | ||
| 80 | public define ProtocolResult | 91 | public define ProtocolResult |
| 81 | wait_for_reply | 92 | wait_for_reply |
| 82 | ( | 93 | ( |
| @@ -87,17 +98,18 @@ public define ProtocolResult | @@ -87,17 +98,18 @@ public define ProtocolResult | ||
| 87 | if mQ.get_next_received_Message(t_out) is | 98 | if mQ.get_next_received_Message(t_out) is |
| 88 | { | 99 | { |
| 89 | timeout then timeout, | 100 | timeout then timeout, |
| 90 | - closed then println("wait_for_reply closed");failure, | 101 | + closed then failure, //println("wait_for_reply closed"); |
| 102 | + | ||
| 91 | msg(_msg) then | 103 | msg(_msg) then |
| 92 | if *_msg.what = _CXM_ACK then | 104 | if *_msg.what = _CXM_ACK then |
| 93 | if find_int32(_msg, "CMD") is | 105 | if find_int32(_msg, "CMD") is |
| 94 | { | 106 | { |
| 95 | - failure then println("wait_for_reply CMD");failure, | 107 | + failure then failure, //println("wait_for_reply CMD"); |
| 96 | success(cmd) then | 108 | success(cmd) then |
| 97 | - println("wait_for_reply CMD="+to_hexa(cmd)); | 109 | +// println("wait_for_reply CMD="+to_hexa(cmd)); |
| 98 | if find_int32(_msg, "STATUS") is | 110 | if find_int32(_msg, "STATUS") is |
| 99 | { | 111 | { |
| 100 | - failure then println("wait_for_reply STATUS");failure, | 112 | + failure then failure, //println("wait_for_reply STATUS"); |
| 101 | success(status) then | 113 | success(status) then |
| 102 | if cmd = wait_cmd & status = _CXM_OK then | 114 | if cmd = wait_cmd & status = _CXM_OK then |
| 103 | if find_message(_msg, "RESULT") is | 115 | if find_message(_msg, "RESULT") is |
| @@ -110,10 +122,10 @@ public define ProtocolResult | @@ -110,10 +122,10 @@ public define ProtocolResult | ||
| 110 | else if cmd = wait_cmd & status = _CXM_UNKNOW_CMD then | 122 | else if cmd = wait_cmd & status = _CXM_UNKNOW_CMD then |
| 111 | unknow_cmd | 123 | unknow_cmd |
| 112 | else | 124 | else |
| 113 | - println("wait_for_reply ");failure | 125 | + failure //println("wait_for_reply "); |
| 114 | } | 126 | } |
| 115 | } | 127 | } |
| 116 | else | 128 | else |
| 117 | - println("wait_for_reply not ACK");failure | 129 | + failure //println("wait_for_reply not ACK"); |
| 118 | }. | 130 | }. |
| 119 | 131 |
calexium_lib/net_services/CXM_net_services.anubis
| @@ -91,7 +91,7 @@ define One | @@ -91,7 +91,7 @@ define One | ||
| 91 | List(NetService) net_services | 91 | List(NetService) net_services |
| 92 | )= | 92 | )= |
| 93 | //TODO add a real management of error | 93 | //TODO add a real management of error |
| 94 | - println("Service NEGOCIATION [" + to_hexa(*msg.what) + "] received"); | 94 | + //println("Service NEGOCIATION [" + to_hexa(*msg.what) + "] received"); |
| 95 | if * msg.what = _CXM_REQUEST_FOR_SERVICE then | 95 | if * msg.what = _CXM_REQUEST_FOR_SERVICE then |
| 96 | if has_service(queue, msg, net_services) is | 96 | if has_service(queue, msg, net_services) is |
| 97 | { | 97 | { |
| @@ -119,12 +119,12 @@ define One | @@ -119,12 +119,12 @@ define One | ||
| 119 | if queue.quit_requested(unique) then | 119 | if queue.quit_requested(unique) then |
| 120 | unique | 120 | unique |
| 121 | else | 121 | else |
| 122 | - println("PRE SERVICE message_receiver "+"["+virtual_machine_id + "]"); | 122 | + //println("PRE SERVICE message_receiver "+"["+virtual_machine_id + "]"); |
| 123 | if queue.get_next_received_Message(1) is | 123 | if queue.get_next_received_Message(1) is |
| 124 | { | 124 | { |
| 125 | timeout then println("PRE timeout");message_receiver(queue, net_services), | 125 | timeout then println("PRE timeout");message_receiver(queue, net_services), |
| 126 | closed then println("PRE closed");unique, | 126 | closed then println("PRE closed");unique, |
| 127 | - msg(msg) then println("PRE negociation"); | 127 | + msg(msg) then unique; //println("PRE negociation"); |
| 128 | service_negociation(queue, msg, net_services); | 128 | service_negociation(queue, msg, net_services); |
| 129 | message_receiver(queue, net_services) | 129 | message_receiver(queue, net_services) |
| 130 | }. | 130 | }. |
| @@ -138,10 +138,10 @@ define Server -> (RWStream) -> One | @@ -138,10 +138,10 @@ define Server -> (RWStream) -> One | ||
| 138 | if remote_IP_address_and_port(conn) is (num_peer,_) then | 138 | if remote_IP_address_and_port(conn) is (num_peer,_) then |
| 139 | //convert IP address of the client to string | 139 | //convert IP address of the client to string |
| 140 | with peer = ip_addr_to_string(num_peer), | 140 | with peer = ip_addr_to_string(num_peer), |
| 141 | - println("NET SERVICES Accepting connection with "+peer); | 141 | + //println("NET SERVICES Accepting connection with "+peer); |
| 142 | 142 | ||
| 143 | //now managing the list of SERVICES | 143 | //now managing the list of SERVICES |
| 144 | - with queue = create_MessageQueue, | 144 | + with queue = create_MessageQueue("CXM Net Services"), |
| 145 | message_transceiver(conn, queue); | 145 | message_transceiver(conn, queue); |
| 146 | message_receiver(queue, net_services). | 146 | message_receiver(queue, net_services). |
| 147 | 147 |