- Some cleaning in do_sendrecv, added error messages when handling an incorrect socket.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9582 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
65ee3d07e9
commit
8bcc26d8dd
@ -3,6 +3,9 @@ Date Added
|
|||||||
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
||||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||||
|
|
||||||
|
2006/12/28
|
||||||
|
* Some cleaning in do_sendrecv, added error messages when handling an
|
||||||
|
incorrect socket. [Skotlex]
|
||||||
2006/12/27
|
2006/12/27
|
||||||
* Fixed Super Novice 99%+ invincibility triggering when
|
* Fixed Super Novice 99%+ invincibility triggering when
|
||||||
the character dies in a GvG area. [blackhole89]
|
the character dies in a GvG area. [blackhole89]
|
||||||
|
@ -598,7 +598,8 @@ int do_sendrecv(int next)
|
|||||||
fd_set rfd,efd; //Added the Error Set so that such sockets can be made eof. They are the same as the rfd for now. [Skotlex]
|
fd_set rfd,efd; //Added the Error Set so that such sockets can be made eof. They are the same as the rfd for now. [Skotlex]
|
||||||
struct sockaddr_in addr_check;
|
struct sockaddr_in addr_check;
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
int ret,i,size;
|
int ret,i;
|
||||||
|
const int size = sizeof(struct sockaddr);
|
||||||
|
|
||||||
last_tick = time(0);
|
last_tick = time(0);
|
||||||
|
|
||||||
@ -631,22 +632,28 @@ int do_sendrecv(int next)
|
|||||||
for(i = 1; i < fd_max; i++)
|
for(i = 1; i < fd_max; i++)
|
||||||
{
|
{
|
||||||
if(!session[i])
|
if(!session[i])
|
||||||
|
{
|
||||||
|
if (FD_ISSET(i, &readfds)) {
|
||||||
|
ShowError("Deleting non-cleared session %d\n", i);
|
||||||
|
FD_CLR(i, &readfds);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//check the validity of the socket. Does what the last thing did
|
//check the validity of the socket. Does what the last thing did
|
||||||
//just alot faster [Meruru]
|
//just alot faster [Meruru]
|
||||||
size = sizeof(struct sockaddr);
|
|
||||||
if(getsockname(i,(struct sockaddr*)&addr_check,&size)<0)
|
if(getsockname(i,(struct sockaddr*)&addr_check,&size)<0)
|
||||||
if(h_errno == EBADF) //See the #defines at the top
|
if(h_errno == EBADF) //See the #defines at the top
|
||||||
{
|
{
|
||||||
|
ShowError("Deleting invalid session %d\n", i);
|
||||||
free_session_mem(i); //free the bad session
|
free_session_mem(i); //free the bad session
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
FD_SET(i,&readfds);
|
if (!FD_ISSET(i, &readfds))
|
||||||
|
FD_SET(i,&readfds);
|
||||||
ret = i;
|
ret = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd_max = ret;
|
fd_max = ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -662,8 +669,10 @@ int do_sendrecv(int next)
|
|||||||
session[rfd.fd_array[i]]->func_recv)
|
session[rfd.fd_array[i]]->func_recv)
|
||||||
session[rfd.fd_array[i]]->func_recv(rfd.fd_array[i]);
|
session[rfd.fd_array[i]]->func_recv(rfd.fd_array[i]);
|
||||||
}
|
}
|
||||||
for(i=0;i<(int)efd.fd_count;i++)
|
for(i=0;i<(int)efd.fd_count;i++) {
|
||||||
|
ShowDebug("do_sendrecv: Connection error on Session %d.\n", efd.fd_array[i]);
|
||||||
set_eof(efd.fd_array[i]);
|
set_eof(efd.fd_array[i]);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 1; i < fd_max; i++)
|
for (i = 1; i < fd_max; i++)
|
||||||
{
|
{
|
||||||
@ -677,7 +686,7 @@ int do_sendrecv(int next)
|
|||||||
if(session[i]->wdata_size && session[i]->func_send)
|
if(session[i]->wdata_size && session[i]->func_send)
|
||||||
session[i]->func_send(i);
|
session[i]->func_send(i);
|
||||||
|
|
||||||
if(session[i] && session[i]->eof) //The session check is for when the connection ended in func_parse
|
if(session[i]->eof) //func_send can't free a session, this is safe.
|
||||||
{ //Finally, even if there is no data to parse, connections signalled eof should be closed, so we call parse_func [Skotlex]
|
{ //Finally, even if there is no data to parse, connections signalled eof should be closed, so we call parse_func [Skotlex]
|
||||||
if (session[i]->func_parse)
|
if (session[i]->func_parse)
|
||||||
session[i]->func_parse(i); //This should close the session inmediately.
|
session[i]->func_parse(i); //This should close the session inmediately.
|
||||||
@ -697,7 +706,6 @@ int do_sendrecv(int next)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(FD_ISSET(i,&rfd)){
|
if(FD_ISSET(i,&rfd)){
|
||||||
//ShowMessage("read:%d\n",i);
|
//ShowMessage("read:%d\n",i);
|
||||||
if(session[i]->func_recv)
|
if(session[i]->func_recv)
|
||||||
@ -709,7 +717,7 @@ int do_sendrecv(int next)
|
|||||||
if(session[i]->wdata_size && session[i]->func_send)
|
if(session[i]->wdata_size && session[i]->func_send)
|
||||||
session[i]->func_send(i);
|
session[i]->func_send(i);
|
||||||
|
|
||||||
if(session[i] && session[i]->eof) //The session check is for when the connection ended in func_parse
|
if(session[i]->eof)
|
||||||
{ //Finally, even if there is no data to parse, connections signalled eof should be closed, so we call parse_func [Skotlex]
|
{ //Finally, even if there is no data to parse, connections signalled eof should be closed, so we call parse_func [Skotlex]
|
||||||
if (session[i]->func_parse)
|
if (session[i]->func_parse)
|
||||||
session[i]->func_parse(i); //This should close the session inmediately.
|
session[i]->func_parse(i); //This should close the session inmediately.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user