Change -2 to XMIT_ERROR to clarify a bit more

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@64324 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Olle Johansson 19 years ago
parent b340fcd7d0
commit 1f2afa0ff1

@ -154,6 +154,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define TRUE 1 #define TRUE 1
#endif #endif
#define XMIT_ERROR -2
#define VIDEO_CODEC_MASK 0x1fc0000 /*!< Video codecs from H.261 thru AST_FORMAT_MAX_VIDEO */ #define VIDEO_CODEC_MASK 0x1fc0000 /*!< Video codecs from H.261 thru AST_FORMAT_MAX_VIDEO */
#ifndef IPTOS_MINCOST #ifndef IPTOS_MINCOST
#define IPTOS_MINCOST 0x02 #define IPTOS_MINCOST 0x02
@ -1757,7 +1759,7 @@ static int __sip_xmit(struct sip_pvt *p, char *data, int len)
case EHOSTUNREACH: /* Host can't be reached */ case EHOSTUNREACH: /* Host can't be reached */
case ENETDOWN: /* Inteface down */ case ENETDOWN: /* Inteface down */
case ENETUNREACH: /* Network failure */ case ENETUNREACH: /* Network failure */
res = -2; /* Don't bother with trying to transmit again */ res = XMIT_ERROR; /* Don't bother with trying to transmit again */
} }
} }
if (res != len) if (res != len)
@ -1903,7 +1905,7 @@ static int retrans_pkt(void *data)
append_history(pkt->owner, "ReTx", "%d %s", reschedule, pkt->data); append_history(pkt->owner, "ReTx", "%d %s", reschedule, pkt->data);
xmitres = __sip_xmit(pkt->owner, pkt->data, pkt->packetlen); xmitres = __sip_xmit(pkt->owner, pkt->data, pkt->packetlen);
ast_mutex_unlock(&pkt->owner->lock); ast_mutex_unlock(&pkt->owner->lock);
if (xmitres == -2) if (xmitres == XMIT_ERROR)
ast_log(LOG_WARNING, "Network error on retransmit in dialog %s\n", pkt->owner->callid); ast_log(LOG_WARNING, "Network error on retransmit in dialog %s\n", pkt->owner->callid);
else else
return reschedule; return reschedule;
@ -1915,7 +1917,7 @@ static int retrans_pkt(void *data)
} else if ((pkt->method == SIP_OPTIONS) && sipdebug) { } else if ((pkt->method == SIP_OPTIONS) && sipdebug) {
ast_log(LOG_WARNING, "Cancelling retransmit of OPTIONs (call id %s) \n", pkt->owner->callid); ast_log(LOG_WARNING, "Cancelling retransmit of OPTIONs (call id %s) \n", pkt->owner->callid);
} }
if (xmitres == -2) { if (xmitres == XMIT_ERROR) {
ast_log(LOG_WARNING, "Transmit error :: Cancelling transmission of transaction in call id %s \n", pkt->owner->callid); ast_log(LOG_WARNING, "Transmit error :: Cancelling transmission of transaction in call id %s \n", pkt->owner->callid);
append_history(pkt->owner, "XmitErr", "%s", (ast_test_flag(pkt, FLAG_FATAL)) ? "(Critical)" : "(Non-critical)"); append_history(pkt->owner, "XmitErr", "%s", (ast_test_flag(pkt, FLAG_FATAL)) ? "(Critical)" : "(Non-critical)");
} else } else
@ -2001,7 +2003,7 @@ static enum sip_result __sip_reliable_xmit(struct sip_pvt *p, int seqno, int res
xmitres = __sip_xmit(pkt->owner, pkt->data, pkt->packetlen); /* Send packet */ xmitres = __sip_xmit(pkt->owner, pkt->data, pkt->packetlen); /* Send packet */
if (xmitres == -2) { /* Serious network trouble, no need to try again */ if (xmitres == XMIT_ERROR) { /* Serious network trouble, no need to try again */
append_history(pkt->owner, "XmitErr", "%s", (ast_test_flag(pkt, FLAG_FATAL)) ? "(Critical)" : "(Non-critical)"); append_history(pkt->owner, "XmitErr", "%s", (ast_test_flag(pkt, FLAG_FATAL)) ? "(Critical)" : "(Non-critical)");
ast_sched_del(sched, pkt->retransid); /* No more retransmission */ ast_sched_del(sched, pkt->retransid); /* No more retransmission */
pkt->retransid = -1; pkt->retransid = -1;
@ -2870,7 +2872,7 @@ static int sip_call(struct ast_channel *ast, char *dest, int timeout)
if (option_debug > 1) if (option_debug > 1)
ast_log(LOG_DEBUG,"Our T38 capability (%d), joint T38 capability (%d)\n", p->t38.capability, p->t38.jointcapability); ast_log(LOG_DEBUG,"Our T38 capability (%d), joint T38 capability (%d)\n", p->t38.capability, p->t38.jointcapability);
xmitres = transmit_invite(p, SIP_INVITE, 1, 2); xmitres = transmit_invite(p, SIP_INVITE, 1, 2);
if (xmitres == -2) if (xmitres == XMIT_ERROR)
return -1; /* Transmission error */ return -1; /* Transmission error */
p->invitestate = INV_CALLING; p->invitestate = INV_CALLING;
@ -6445,7 +6447,7 @@ static void copy_request(struct sip_request *dst, const struct sip_request *src)
} }
/*! \brief Used for 200 OK and 183 early media /*! \brief Used for 200 OK and 183 early media
\return Will return -2 for network errors. \return Will return XMIT_ERROR for network errors.
*/ */
static int transmit_response_with_sdp(struct sip_pvt *p, const char *msg, const struct sip_request *req, enum xmittype reliable) static int transmit_response_with_sdp(struct sip_pvt *p, const char *msg, const struct sip_request *req, enum xmittype reliable)
{ {
@ -7540,7 +7542,7 @@ static int transmit_info_with_vidupdate(struct sip_pvt *p)
} }
/*! \brief Transmit generic SIP request /*! \brief Transmit generic SIP request
returns -2 if transmit failed with a critical error (don't retry) returns XMIT_ERROR if transmit failed with a critical error (don't retry)
*/ */
static int transmit_request(struct sip_pvt *p, int sipmethod, int seqno, enum xmittype reliable, int newbranch) static int transmit_request(struct sip_pvt *p, int sipmethod, int seqno, enum xmittype reliable, int newbranch)
{ {
@ -11974,7 +11976,7 @@ static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, stru
ast_queue_control(p->owner, AST_CONTROL_CONGESTION); ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
break; break;
} }
if (xmitres == -2) if (xmitres == XMIT_ERROR)
ast_log(LOG_WARNING, "Could not transmit message in dialog %s\n", p->callid); ast_log(LOG_WARNING, "Could not transmit message in dialog %s\n", p->callid);
} }
@ -15311,7 +15313,7 @@ static int sip_poke_peer(struct sip_peer *peer)
xmitres = transmit_invite(p, SIP_OPTIONS, 0, 2); xmitres = transmit_invite(p, SIP_OPTIONS, 0, 2);
#endif #endif
gettimeofday(&peer->ps, NULL); gettimeofday(&peer->ps, NULL);
if (xmitres == -2) if (xmitres == XMIT_ERROR)
sip_poke_noanswer(peer); /* Immediately unreachable, network problems */ sip_poke_noanswer(peer); /* Immediately unreachable, network problems */
else else
peer->pokeexpire = ast_sched_add(sched, DEFAULT_MAXMS * 2, sip_poke_noanswer, peer); peer->pokeexpire = ast_sched_add(sched, DEFAULT_MAXMS * 2, sip_poke_noanswer, peer);

Loading…
Cancel
Save