+ if isRts {
+ currBuffer = C.rmr_rts_msg(m.context, txBuffer)
+ } else {
+ currBuffer = C.rmr_send_msg(m.context, txBuffer)
+ }
+ }
+
+ if currBuffer == nil {
+ m.UpdateStatCounter("TransmitError")
+ return m.LogMBufError("SendBuf failed", txBuffer)
+ }
+
+ // Just quick retry seems to help for K8s issue
+ maxRetryOnFailure := viper.GetInt("rmr.maxRetryOnFailure")
+ if maxRetryOnFailure == 0 {
+ maxRetryOnFailure = 5
+ }
+
+ for j := 0; j < maxRetryOnFailure && currBuffer != nil && currBuffer.state == C.RMR_ERR_RETRY; j++ {
+ if whid != 0 {
+ currBuffer = C.rmr_wh_send_msg(m.context, C.rmr_whid_t(whid), txBuffer)
+ } else {
+ if isRts {
+ currBuffer = C.rmr_rts_msg(m.context, txBuffer)
+ } else {
+ currBuffer = C.rmr_send_msg(m.context, txBuffer)
+ }
+ }
+ }
+
+ if currBuffer.state != C.RMR_OK {
+ counterName = "TransmitError"
+ m.LogMBufError("SendBuf failed", currBuffer)
+ }
+
+ m.UpdateStatCounter(counterName)
+ defer m.Free(currBuffer)
+
+ return int(currBuffer.state)
+}
+
+func (m *RMRClient) SendCallMsg(params *RMRParams) (int, string) {
+ var (
+ currBuffer *C.rmr_mbuf_t
+ counterName string = "Transmitted"
+ )
+ txBuffer := m.CopyBuffer(params)
+ if txBuffer == nil {
+ return C.RMR_ERR_INITFAILED, ""
+ }
+
+ txBuffer.state = 0
+
+ currBuffer = C.rmr_wh_call(m.context, C.int(params.Whid), txBuffer, C.int(params.Callid), C.int(params.Timeout))
+
+ if currBuffer == nil {
+ m.UpdateStatCounter("TransmitError")
+ return m.LogMBufError("SendBuf failed", txBuffer), ""
+ }
+
+ if currBuffer.state != C.RMR_OK {
+ counterName = "TransmitError"
+ m.LogMBufError("SendBuf failed", currBuffer)