Skip to content

Commit

Permalink
Updated LiteSpeed SAPI to 7.1 .
Browse files Browse the repository at this point in the history
  • Loading branch information
George Wang committed Apr 10, 2018
1 parent 8cfb648 commit 5b529bb
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 688 deletions.
2 changes: 1 addition & 1 deletion sapi/litespeed/lsapi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ static int sapi_lsapi_activate()
static sapi_module_struct lsapi_sapi_module =
{
"litespeed",
"LiteSpeed V7.0",
"LiteSpeed V7.1",

php_lsapi_startup, /* startup */
php_module_shutdown_wrapper, /* shutdown */
Expand Down
32 changes: 23 additions & 9 deletions sapi/litespeed/lsapilib.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ static int *s_accepting_workers = NULL;
static int *s_global_counter = &s_req_processed;
static int s_max_busy_workers = -1;
static char *s_stderr_log_path = NULL;
static int s_ignore_pid = -1;

LSAPI_Request g_req =
{ .m_fdListen = -1, .m_fd = -1 };
Expand Down Expand Up @@ -1140,7 +1141,13 @@ static int lsapi_changeUGid( LSAPI_Request * pReq )
}

s_uid = uid;


if ( pReq->m_fdListen != -1 )
{
close( pReq->m_fdListen );
pReq->m_fdListen = -1;
}

pStderrLog = LSAPI_GetEnv_r( pReq, "LSAPI_STDERR_LOG");
if (pStderrLog)
lsapi_reopen_stderr(pStderrLog);
Expand Down Expand Up @@ -2806,6 +2813,12 @@ static void lsapi_sigchild( int signal )
pid = 0;
continue;
}
if ( pid == s_ignore_pid )
{
pid = 0;
s_ignore_pid = -1;
continue;
}
child_status = find_child_status( pid );
if ( child_status )
{
Expand Down Expand Up @@ -3024,7 +3037,7 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer,
while( !s_stop )
{
if (s_proc_group_timer_cb != NULL) {
s_proc_group_timer_cb();
s_proc_group_timer_cb(&s_ignore_pid);
}

curTime = time( NULL );
Expand Down Expand Up @@ -3119,13 +3132,14 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer,
if (s_busy_workers)
__sync_add_and_fetch(s_busy_workers, 1);
lsapi_set_nblock( pReq->m_fd, 0 );
//keep it open if busy_count is used.
s_keepListener = 1;
// if ( pReq->m_fdListen != -1 )
// {
// close( pReq->m_fdListen );
// pReq->m_fdListen = -1;
// }
//keep it open if busy_count is used.
if (s_busy_workers && s_uid != 0)
s_keepListener = 1;
else if ( pReq->m_fdListen != -1 )
{
close( pReq->m_fdListen );
pReq->m_fdListen = -1;
}
/* don't catch our signals */
sigaction( SIGCHLD, &old_child, 0 );
sigaction( SIGTERM, &old_term, 0 );
Expand Down
2 changes: 1 addition & 1 deletion sapi/litespeed/lsapilib.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ int LSAPI_is_suEXEC_Daemon(void);

int LSAPI_Set_Restored_Parent_Pid(int pid);

typedef void (*LSAPI_On_Timer_pf)(void);
typedef void (*LSAPI_On_Timer_pf)(int *forked_child_pid);
void LSAPI_Register_Pgrp_Timer_Callback(LSAPI_On_Timer_pf);

int LSAPI_Inc_Req_Processed(int cnt);
Expand Down

0 comments on commit 5b529bb

Please sign in to comment.