ruby-lsapi 3.0 → 3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/ext/lsapi/lsapilib.c +19 -9
  2. metadata +3 -3
data/ext/lsapi/lsapilib.c CHANGED
@@ -1170,10 +1170,7 @@ int LSAPI_ForeachOrgHeader_r( LSAPI_Request * pReq,
1170
1170
  }
1171
1171
  if ( pReq->m_pHeader->m_cntUnknownHeaders > 0 )
1172
1172
  {
1173
- char achHeaderName[256];
1174
- char *p;
1175
1173
  char *pKey;
1176
- char *pKeyEnd ;
1177
1174
  int keyLen;
1178
1175
  struct lsapi_header_offset * pCur, *pEnd;
1179
1176
  pCur = pReq->m_pUnknownHeader;
@@ -1534,9 +1531,10 @@ static fn_select_t g_fnSelect = select;
1534
1531
  typedef struct _lsapi_child_status
1535
1532
  {
1536
1533
  int m_pid;
1537
- short m_iKillSent;
1534
+
1535
+ volatile short m_iKillSent;
1538
1536
  volatile short m_inProcess;
1539
-
1537
+
1540
1538
  volatile long m_tmWaitBegin;
1541
1539
  volatile long m_tmReqBegin;
1542
1540
  volatile long m_tmLastCheckPoint;
@@ -1705,7 +1703,7 @@ static void lsapi_check_child_status( long tmCur )
1705
1703
  {
1706
1704
 
1707
1705
  if (( g_prefork_server->m_iCurChildren - dying > g_prefork_server->m_iMaxChildren)||
1708
- ( idle > g_prefork_server->m_iMaxIdleChildren ))
1706
+ ( idle >= g_prefork_server->m_iMaxIdleChildren ))
1709
1707
  {
1710
1708
  tobekilled = 1;
1711
1709
  }
@@ -1724,15 +1722,22 @@ static void lsapi_check_child_status( long tmCur )
1724
1722
  tobekilled = 1;
1725
1723
  }
1726
1724
  }
1725
+ else
1726
+ {
1727
+ if ( pStatus->m_inProcess )
1728
+ tobekilled = pStatus->m_iKillSent = 0;
1729
+ }
1727
1730
  if ( tobekilled )
1728
1731
  {
1729
1732
  tobekilled = 0;
1730
1733
  if ( pStatus->m_iKillSent > 5 )
1731
1734
  tobekilled = SIGKILL;
1732
- else if ( pStatus->m_iKillSent == 2 )
1735
+ else if ( pStatus->m_iKillSent == 3 )
1733
1736
  tobekilled = SIGTERM;
1734
- else if ( pStatus->m_iKillSent == 0 )
1737
+ else if ( pStatus->m_iKillSent == 1 )
1738
+ {
1735
1739
  tobekilled = SIGUSR1;
1740
+ }
1736
1741
  if ( tobekilled )
1737
1742
  kill( pStatus->m_pid, tobekilled );
1738
1743
  ++pStatus->m_iKillSent;
@@ -1873,7 +1878,8 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, LSAPI_Re
1873
1878
  s_ppid = getppid();
1874
1879
  s_req_processed = 0;
1875
1880
  s_pChildStatus = child_status;
1876
-
1881
+ child_status->m_iKillSent = 0;
1882
+
1877
1883
  /* don't catch our signals */
1878
1884
  sigaction( SIGCHLD, &old_child, 0 );
1879
1885
  sigaction( SIGTERM, &old_term, 0 );
@@ -1955,6 +1961,8 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq )
1955
1961
  {
1956
1962
  if ( !g_running )
1957
1963
  return -1;
1964
+ if (( s_pChildStatus )&&( s_pChildStatus->m_iKillSent ))
1965
+ return -1;
1958
1966
  FD_ZERO( &readfds );
1959
1967
  FD_SET( fd, &readfds );
1960
1968
  timeout.tv_sec = 1;
@@ -1981,6 +1989,8 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq )
1981
1989
  }
1982
1990
  else if ( ret >= 1 )
1983
1991
  {
1992
+ if (( s_pChildStatus )&&( s_pChildStatus->m_iKillSent ))
1993
+ return -1;
1984
1994
  if ( fd == pReq->m_fdListen )
1985
1995
  {
1986
1996
  pReq->m_fd = lsapi_accept( pReq->m_fdListen );
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: ruby-lsapi
5
5
  version: !ruby/object:Gem::Version
6
- version: "3.0"
7
- date: 2008-01-31 00:00:00 -05:00
6
+ version: "3.1"
7
+ date: 2008-02-25 00:00:00 -05:00
8
8
  summary: A ruby extension for fast communication with LiteSpeed Web Server.
9
9
  require_paths:
10
10
  - lib