mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
Merged revisions 68313 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r68313 | kpfleming | 2007-06-07 17:14:35 -0500 (Thu, 07 Jun 2007) | 6 lines some improvements to the IAX2 full frame dropping logic recently added: - use inaddrcmp(), since we have it - output the type of frame and subclass being dropped, and the type/subclass that is already being processed (which caused the drop) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@68321 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -726,12 +726,16 @@ struct iax2_thread {
|
|||||||
time_t checktime;
|
time_t checktime;
|
||||||
ast_mutex_t lock;
|
ast_mutex_t lock;
|
||||||
ast_cond_t cond;
|
ast_cond_t cond;
|
||||||
/*! If this thread is processing a full frame, the callno for that frame
|
/*! if this thread is processing a full frame,
|
||||||
* will be here, so we can avoid dispatching any more full frames
|
some information about that frame will be stored
|
||||||
* or that callno to other threads */
|
here, so we can avoid dispatching any more full
|
||||||
unsigned short ffcallno;
|
frames for that callno to other threads */
|
||||||
/*! Remember the peer IP/port number for a full frame in process */
|
struct {
|
||||||
struct sockaddr_in ffsin;
|
unsigned short callno;
|
||||||
|
struct sockaddr_in sin;
|
||||||
|
unsigned char type;
|
||||||
|
unsigned char csub;
|
||||||
|
} ffinfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Thread lists */
|
/* Thread lists */
|
||||||
@@ -974,10 +978,8 @@ static struct iax2_thread *find_idle_thread(void)
|
|||||||
|
|
||||||
/* this thread is not processing a full frame (since it is idle),
|
/* this thread is not processing a full frame (since it is idle),
|
||||||
so ensure that the field for the full frame call number is empty */
|
so ensure that the field for the full frame call number is empty */
|
||||||
if (thread) {
|
if (thread)
|
||||||
thread->ffcallno = 0;
|
memset(&thread->ffinfo, 0, sizeof(thread->ffinfo));
|
||||||
memset(&thread->ffsin, 0, sizeof(thread->ffsin));
|
|
||||||
}
|
|
||||||
|
|
||||||
return thread;
|
return thread;
|
||||||
}
|
}
|
||||||
@@ -6562,22 +6564,24 @@ static int socket_read(int *id, int fd, short events, void *cbdata)
|
|||||||
|
|
||||||
AST_LIST_LOCK(&active_list);
|
AST_LIST_LOCK(&active_list);
|
||||||
AST_LIST_TRAVERSE(&active_list, cur, list) {
|
AST_LIST_TRAVERSE(&active_list, cur, list) {
|
||||||
if ((cur->ffcallno == ntohs(fh->scallno)) &&
|
if ((cur->ffinfo.callno == ntohs(fh->scallno)) &&
|
||||||
!memcmp(&cur->ffsin, &thread->iosin, sizeof(cur->ffsin)))
|
!inaddrcmp(&cur->ffinfo.sin, &thread->iosin))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
AST_LIST_UNLOCK(&active_list);
|
AST_LIST_UNLOCK(&active_list);
|
||||||
if (cur) {
|
if (cur) {
|
||||||
/* we found another thread processing a full frame for this call,
|
/* we found another thread processing a full frame for this call,
|
||||||
so we can't accept this frame */
|
so we can't accept this frame */
|
||||||
ast_log(LOG_WARNING, "Dropping full frame from %s (callno %d) received too rapidly\n",
|
ast_log(LOG_WARNING, "Dropping frame from %s (callno %d) of type %d (subclass %d) due to frame of type %d (subclass %d) already in process\n",
|
||||||
ast_inet_ntoa(thread->iosin.sin_addr), cur->ffcallno);
|
ast_inet_ntoa(thread->iosin.sin_addr), cur->ffinfo.callno,
|
||||||
|
fh->type, uncompress_subclass(fh->csub),
|
||||||
|
cur->ffinfo.type, uncompress_subclass(cur->ffinfo.csub));
|
||||||
insert_idle_thread(thread);
|
insert_idle_thread(thread);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
/* this thread is going to process this frame, so mark it */
|
/* this thread is going to process this frame, so mark it */
|
||||||
thread->ffcallno = ntohs(fh->scallno);
|
thread->ffinfo.callno = ntohs(fh->scallno);
|
||||||
memcpy(&thread->ffsin, &thread->iosin, sizeof(thread->ffsin));
|
memcpy(&thread->ffinfo.sin, &thread->iosin, sizeof(thread->ffinfo.sin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user