@ -703,12 +703,16 @@ struct iax2_thread {
time_t checktime ;
ast_mutex_t lock ;
ast_cond_t cond ;
unsigned short ffcallno ; /* if this thread is processing a full frame, the
callno for that frame will be here , so we can
avoid dispatching any more full frames for that
callno to other threads */
struct sockaddr_in ffsin ; /* remember the peer IP/port number for a full frame
in process */
/*! if this thread is processing a full frame,
some information about that frame will be stored
here , so we can avoid dispatching any more full
frames for that callno to other threads */
struct {
unsigned short callno ;
struct sockaddr_in sin ;
unsigned char type ;
unsigned char csub ;
} ffinfo ;
} ;
/* Thread lists */
@ -888,10 +892,8 @@ static struct iax2_thread *find_idle_thread(void)
/* 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 */
if ( thread ) {
thread - > ffcallno = 0 ;
memset ( & thread - > ffsin , 0 , sizeof ( thread - > ffsin ) ) ;
}
if ( thread )
memset ( & thread - > ffinfo , 0 , sizeof ( thread - > ffinfo ) ) ;
return thread ;
}
@ -6309,22 +6311,24 @@ static int socket_read(int *id, int fd, short events, void *cbdata)
AST_LIST_LOCK ( & active_list ) ;
AST_LIST_TRAVERSE ( & active_list , cur , list ) {
if ( ( cur - > ff callno = = ntohs ( fh - > scallno ) ) & &
! mem cmp( & cur - > ff sin, & thread - > iosin , sizeof ( cur - > ffsin ) ) )
if ( ( cur - > ff info. callno = = ntohs ( fh - > scallno ) ) & &
! inaddr cmp( & cur - > ff info. sin, & thread - > iosin ) )
break ;
}
AST_LIST_UNLOCK ( & active_list ) ;
if ( cur ) {
/* we found another thread processing a full frame for this call,
so we can ' t accept this frame */
ast_log ( LOG_WARNING , " Dropping full frame from %s (callno %d) received too rapidly \n " ,
ast_inet_ntoa ( thread - > iosin . sin_addr ) , cur - > ffcallno ) ;
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 - > ffinfo . callno ,
fh - > type , uncompress_subclass ( fh - > csub ) ,
cur - > ffinfo . type , uncompress_subclass ( cur - > ffinfo . csub ) ) ;
insert_idle_thread ( thread ) ;
return 1 ;
} else {
/* this thread is going to process this frame, so mark it */
thread - > ff callno = ntohs ( fh - > scallno ) ;
memcpy ( & thread - > ff sin, & thread - > iosin , sizeof ( thread - > ff sin) ) ;
thread - > ff info. callno = ntohs ( fh - > scallno ) ;
memcpy ( & thread - > ff info. sin, & thread - > iosin , sizeof ( thread - > ff info. sin) ) ;
}
}