diff options
author | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-04-09 09:09:35 +0000 |
---|---|---|
committer | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-04-09 09:09:35 +0000 |
commit | 1260d294ed795011b5b73284e308a6a01d9eef9e (patch) | |
tree | 6663a0ae44f8ac7d830598311411843401f129a1 /src/common | |
parent | 28532995686a5315ddf0ad6557ae00cb2fe76206 (diff) | |
download | hercules-1260d294ed795011b5b73284e308a6a01d9eef9e.tar.gz hercules-1260d294ed795011b5b73284e308a6a01d9eef9e.tar.bz2 hercules-1260d294ed795011b5b73284e308a6a01d9eef9e.tar.xz hercules-1260d294ed795011b5b73284e308a6a01d9eef9e.zip |
* Merged changes from trunk [14742:14782/trunk].
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/renewal@14783 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/socket.c | 7 | ||||
-rw-r--r-- | src/common/timer.c | 2 | ||||
-rw-r--r-- | src/common/utils.c | 2 |
3 files changed, 4 insertions, 7 deletions
diff --git a/src/common/socket.c b/src/common/socket.c index 0a576e517..262351dcf 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -749,7 +749,7 @@ int do_sockets(int next) if(session[i]->wdata_size) session[i]->func_send(i); - if(session[i]->eof) //func_send can't free a session, this is safe. + if(session[i]->flag.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] session[i]->func_parse(i); //This should close the session immediately. } @@ -1351,9 +1351,6 @@ void send_shortlist_do_sends() { int i = 0; - // Assume all or most of the fd's don't remain in the shortlist - memset(send_shortlist_set, 0, sizeof(send_shortlist_set)); - while( i < send_shortlist_count ) { int fd = send_shortlist_array[i]; @@ -1375,7 +1372,6 @@ void send_shortlist_do_sends() // be sent from it we'll keep it in the shortlist. if( session[fd] && !session[fd]->flag.eof && session[fd]->wdata_size ) { - send_shortlist_set[fd/32] |= 1<<(fd%32); ++i; continue; } @@ -1383,6 +1379,7 @@ void send_shortlist_do_sends() // Remove fd from shortlist, move the last fd to the current position send_shortlist_array[i] = send_shortlist_array[--send_shortlist_count]; + send_shortlist_set[fd/32]&=~(1<<(fd%32)); } } #endif diff --git a/src/common/timer.c b/src/common/timer.c index 190e41eaf..86e148ee3 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -146,7 +146,7 @@ static unsigned int tick(void) // return (unsigned int)((_rdtsc() - RDTSC_BEGINTICK) / RDTSC_CLOCK); // -#elif (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK) /* posix compliant */) || (defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 500005 /* FreeBSD >= 5.1.0 */) +#elif defined(HAVE_MONOTONIC_CLOCK) struct timespec tval; clock_gettime(CLOCK_MONOTONIC, &tval); return tval.tv_sec * 1000 + tval.tv_nsec / 1000000; diff --git a/src/common/utils.c b/src/common/utils.c index f1813ea41..1602afa52 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -269,7 +269,7 @@ unsigned int get_percentage(const unsigned int A, const unsigned int B) if( B == 0 ) { ShowError("get_percentage(): divison by zero! (A=%u,B=%u)\n", A, B); - return -1; + return ~0U; } result = 100 * ((double)A / (double)B); |