+func (m *RMRClient) SendBuf(txBuffer *C.rmr_mbuf_t, isRts bool, whid int) int {
+ txBuffer.state = 0
+
+ // Just quick retry seems to help for K8s issue
+ if m.maxRetryOnFailure == 0 {
+ m.maxRetryOnFailure = 5
+ }
+
+ for j := 0; j <= m.maxRetryOnFailure; j++ {
+ m.contextMux.Lock()
+ if whid != 0 {
+ txBuffer = C.rmr_wh_send_msg(m.context, C.rmr_whid_t(whid), txBuffer)
+ } else {
+ if isRts {
+ txBuffer = C.rmr_rts_msg(m.context, txBuffer)
+ } else {
+ txBuffer = C.rmr_send_msg(m.context, txBuffer)
+ }
+ }
+ m.contextMux.Unlock()
+ if j+1 <= m.maxRetryOnFailure && txBuffer != nil && txBuffer.state == C.RMR_ERR_RETRY {
+ m.UpdateStatCounter("TransmitRetry")
+ continue
+ }
+ break
+ }
+
+ if txBuffer == nil {
+ m.UpdateStatCounter("TransmitError")
+ m.LogMBufError("SendBuf failed", txBuffer)
+ return int(C.RMR_ERR_INITFAILED)
+ }
+
+ if txBuffer.state != C.RMR_OK {
+ m.UpdateStatCounter("TransmitError")
+ m.LogMBufError("SendBuf failed", txBuffer)
+ } else {
+ m.UpdateStatCounter("Transmitted")
+ }
+ defer m.Free(txBuffer)
+ return int(txBuffer.state)
+
+}
+
+func (m *RMRClient) SendCallMsg(params *RMRParams) (int, string) {