| 101 | } |
| 102 | |
| 103 | static char * |
| 104 | cib_send_tls(gnutls_session * session, xmlNode * msg) |
| 105 | { |
| 106 | char *xml_text = NULL; |
| 107 | |
| 108 | # if 0 |
| 109 | const char *name = crm_element_name(msg); |
| 110 | |
| 111 | if (safe_str_neq(name, "cib_command")) { |
| 112 | xmlNodeSetName(msg, "cib_result"); |
| 113 | } |
| 114 | # endif |
| 115 | xml_text = dump_xml_unformatted(msg); |
| 116 | if (xml_text != NULL) { |
| 117 | char *unsent = xml_text; |
| 118 | int len = strlen(xml_text); |
| 119 | int rc = 0; |
| 120 | |
| 121 | len++; /* null char */ |
| 122 | crm_trace("Message size: %d", len); |
| 123 | |
| 124 | while (TRUE) { |
| 125 | rc = gnutls_record_send(*session, unsent, len); |
| 126 | crm_debug("Sent %d bytes", rc); |
| 127 | |
| 128 | if (rc == GNUTLS_E_INTERRUPTED || rc == GNUTLS_E_AGAIN) { |
| 129 | crm_debug("Retry"); |
| 130 | |
| 131 | } else if (rc < 0) { |
| 132 | crm_debug("Connection terminated"); |
| 133 | break; |
| 134 | |
| 135 | } else if (rc < len) { |
| 136 | crm_debug("Only sent %d of %d bytes", rc, len); |
| 137 | len -= rc; |
| 138 | unsent += rc; |
| 139 | } else { |
| 140 | break; |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | } |
| 145 | free(xml_text); |
| 146 | return NULL; |
| 147 | |
| 148 | } |
| 149 | |
| 150 | static char * |
| 151 | cib_recv_tls(gnutls_session * session) |
no test coverage detected