MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / cib_send_tls

Function cib_send_tls

lib/common/remote.c:103–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103static char *
104cib_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
150static char *
151cib_recv_tls(gnutls_session * session)

Callers 1

crm_send_remote_msgFunction · 0.85

Calls 2

safe_str_neqFunction · 0.85
dump_xml_unformattedFunction · 0.85

Tested by

no test coverage detected