mirror of
https://github.com/transmission/transmission
synced 2025-03-03 18:25:35 +00:00
(trunk libT) #4085 "transmission crashed when adding a new torrent: assert failed" -- possible fix?
This commit is contained in:
parent
7ad41603e9
commit
9e07e19b05
1 changed files with 9 additions and 8 deletions
|
@ -670,16 +670,17 @@ tr_fdSocketAccept( tr_session * s, int sockfd, tr_address * addr, tr_port * port
|
|||
len = sizeof( struct sockaddr_storage );
|
||||
fd = accept( sockfd, (struct sockaddr *) &sock, &len );
|
||||
|
||||
if( ( fd >= 0 ) && gFd->socket_count > gFd->socket_limit )
|
||||
{
|
||||
tr_netCloseSocket( fd );
|
||||
fd = -1;
|
||||
}
|
||||
|
||||
if( fd >= 0 )
|
||||
{
|
||||
tr_ssToAddr( addr, port, &sock );
|
||||
++gFd->socket_count;
|
||||
if( ( gFd->socket_count < gFd->socket_limit ) && tr_ssToAddr( addr, port, &sock ) )
|
||||
{
|
||||
++gFd->socket_count;
|
||||
}
|
||||
else
|
||||
{
|
||||
tr_netCloseSocket( fd );
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return fd;
|
||||
|
|
Loading…
Reference in a new issue