Commit a1fffdbedd87ad1aef526f55a601ae008ab463c2
1 parent
9d67fed6
Add SSL connection method for net services
Improve some logs
Showing
2 changed files
with
30 additions
and
2 deletions
Show diff stats
calexium_lib/net_services/CXM_generic_client.anubis
| @@ -15,6 +15,7 @@ read system/convert.anubis | @@ -15,6 +15,7 @@ read system/convert.anubis | ||
| 15 | read system/string.anubis | 15 | read system/string.anubis |
| 16 | read system/message_queue.anubis | 16 | read system/message_queue.anubis |
| 17 | read system/message_transceiver.anubis | 17 | read system/message_transceiver.anubis |
| 18 | +read tools/connections.anubis | ||
| 18 | 19 | ||
| 19 | read calexium_lib/CXM_message_constants.anubis | 20 | read calexium_lib/CXM_message_constants.anubis |
| 20 | read calexium_lib/net_services/CXM_net_services.anubis | 21 | read calexium_lib/net_services/CXM_net_services.anubis |
| @@ -160,7 +161,34 @@ public define Maybe($T) | @@ -160,7 +161,34 @@ public define Maybe($T) | ||
| 160 | error(_) then logger(queue_name + ": Can't connect to domain manager ["+ip_addr_to_string(server)+":"+port+"]");failure, | 161 | error(_) then logger(queue_name + ": Can't connect to domain manager ["+ip_addr_to_string(server)+":"+port+"]");failure, |
| 161 | ok(conn) then | 162 | ok(conn) then |
| 162 | with queue = create_MessageQueue(queue_name), | 163 | with queue = create_MessageQueue(queue_name), |
| 163 | - message_transceiver(conn, queue); | 164 | + message_transceiver(tcp(conn), queue); |
| 165 | + with result = generic_request_for_service(queue, service_id, service_version, handler, logger), | ||
| 166 | + queue.quit(unique); | ||
| 167 | + //logInfo(debug_log,"domain_manager client quit"); | ||
| 168 | + result | ||
| 169 | + }. | ||
| 170 | + | ||
| 171 | +public define Maybe($T) | ||
| 172 | + generic_connect_to_net_service_SSL | ||
| 173 | + ( | ||
| 174 | + String queue_name, | ||
| 175 | + String server_name, | ||
| 176 | + Word32 server_ip, | ||
| 177 | + Word32 port, | ||
| 178 | + (Maybe(X509)) -> Bool accept_policy, // your policy for accepting the server certificate in | ||
| 179 | + // case of an invalid, non trusted or missing certificate | ||
| 180 | + Word32 service_id, | ||
| 181 | + Word32 service_version, | ||
| 182 | + (MessageQueue, String) -> Maybe($T) handler, | ||
| 183 | + (String) -> One logger | ||
| 184 | + ) | ||
| 185 | + = | ||
| 186 | + if open_SSL_connection( server_name, server_ip, port, accept_policy) is | ||
| 187 | + { | ||
| 188 | + error(_) then logger(queue_name + ": Can't connect to domain manager ["+ip_addr_to_string(server_ip)+":"+port+"]");failure, | ||
| 189 | + ok(conn) then | ||
| 190 | + with queue = create_MessageQueue(queue_name), | ||
| 191 | + message_transceiver(ssl(conn), queue); | ||
| 164 | with result = generic_request_for_service(queue, service_id, service_version, handler, logger), | 192 | with result = generic_request_for_service(queue, service_id, service_version, handler, logger), |
| 165 | queue.quit(unique); | 193 | queue.quit(unique); |
| 166 | //logInfo(debug_log,"domain_manager client quit"); | 194 | //logInfo(debug_log,"domain_manager client quit"); |
calexium_lib/web/CXM_making_a_web_site.anubis
| @@ -2393,7 +2393,7 @@ public define One | @@ -2393,7 +2393,7 @@ public define One | ||
| 2393 | { | 2393 | { |
| 2394 | cannot_bind_to_port(n) then logError(log, "Cannot bind to port: "+n), | 2394 | cannot_bind_to_port(n) then logError(log, "Cannot bind to port: "+n), |
| 2395 | cannot_bind_to_port(n,m) then logError(log, "Cannot bind to ports: "+n+", "+m), | 2395 | cannot_bind_to_port(n,m) then logError(log, "Cannot bind to ports: "+n+", "+m), |
| 2396 | - ok(s1,s2) then logInfo(log, "Servers started.") | 2396 | + ok(s1,s2) then logInfo(log, "Servers started on ports "+http_port+" (HTTP) and "+https_port+" (HTTPS).") |
| 2397 | }. | 2397 | }. |
| 2398 | 2398 | ||
| 2399 | 2399 |