Skip to content

Commit c357b6f

Browse files
update hook connect
1 parent 64e19be commit c357b6f

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

co_hook_sys_call.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,8 @@ int connect(int fd, const struct sockaddr *address, socklen_t address_len)
262262

263263
if( sizeof(lp->dest) >= address_len )
264264
{
265-
}
265+
memcpy( &(lp->dest),address,(int)address_len );
266266
}
267-
rpchook_t *lp = get_by_fd( fd );
268-
if( lp )
269267
if( O_NONBLOCK & lp->user_flag )
270268
{
271269
return ret;
@@ -978,11 +976,3 @@ struct hostent *co_gethostbyname(const char *name)
978976
}
979977
}
980978

981-
982-
//gzrd_Lib_CPP_Version_ID--start
983-
#ifndef GZRD_SVN_ATTR
984-
#define GZRD_SVN_ATTR "0"
985-
#endif
986-
static char gzrd_Lib_CPP_Version_ID[] __attribute__((used))="$HeadURL$ $Id$ " GZRD_SVN_ATTR "__file__";
987-
// gzrd_Lib_CPP_Version_ID--end
988-

co_routine.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ struct stTimeoutItem_t
323323

324324
enum
325325
{
326-
eMaxTimeout = 40 * 1000 //20s
326+
eMaxTimeout = 40 * 1000 //40s
327327
};
328328
stTimeoutItem_t *pPrev;
329329
stTimeoutItem_t *pNext;
@@ -673,6 +673,8 @@ static uint32_t PollEvent2Epoll( short events )
673673
if( events & POLLOUT ) e |= EPOLLOUT;
674674
if( events & POLLHUP ) e |= EPOLLHUP;
675675
if( events & POLLERR ) e |= EPOLLERR;
676+
if( events & POLLRDNORM ) e |= EPOLLRDNORM;
677+
if( events & POLLWRNORM ) e |= EPOLLWRNORM;
676678
return e;
677679
}
678680
static short EpollEvent2Poll( uint32_t events )
@@ -682,16 +684,17 @@ static short EpollEvent2Poll( uint32_t events )
682684
if( events & EPOLLOUT ) e |= POLLOUT;
683685
if( events & EPOLLHUP ) e |= POLLHUP;
684686
if( events & EPOLLERR ) e |= POLLERR;
687+
if( events & EPOLLRDNORM ) e |= POLLRDNORM;
688+
if( events & EPOLLWRNORM ) e |= POLLWRNORM;
685689
return e;
686690
}
687691

688-
static stCoRoutineEnv_t* g_arrCoEnvPerThread[ 102400 ] = { 0 };
692+
static stCoRoutineEnv_t* g_arrCoEnvPerThread[ 204800 ] = { 0 };
689693
void co_init_curr_thread_env()
690694
{
691695
pid_t pid = GetPid();
692696
g_arrCoEnvPerThread[ pid ] = (stCoRoutineEnv_t*)calloc( 1,sizeof(stCoRoutineEnv_t) );
693697
stCoRoutineEnv_t *env = g_arrCoEnvPerThread[ pid ];
694-
printf("init pid %ld env %p\n",(long)pid,env);
695698

696699
env->iCallStackSize = 0;
697700
struct stCoRoutine_t *self = co_create_env( env, NULL, NULL,NULL );
@@ -1132,5 +1135,3 @@ stCoCondItem_t *co_cond_pop( stCoCond_t *link )
11321135
}
11331136
return p;
11341137
}
1135-
1136-

0 commit comments

Comments
 (0)