@@ -1600,8 +1600,11 @@ int LSAPI_Accept_r( LSAPI_Request * pReq )
1600
1600
}
1601
1601
1602
1602
1603
- static struct lsapi_packet_header finish = {'L' , 'S' ,
1604
- LSAPI_RESP_END , LSAPI_ENDIAN , {LSAPI_PACKET_HEADER_LEN } };
1603
+ static struct lsapi_packet_header finish_close [2 ] =
1604
+ {
1605
+ {'L' , 'S' , LSAPI_RESP_END , LSAPI_ENDIAN , {LSAPI_PACKET_HEADER_LEN } },
1606
+ {'L' , 'S' , LSAPI_CONN_CLOSE , LSAPI_ENDIAN , {LSAPI_PACKET_HEADER_LEN } }
1607
+ };
1605
1608
1606
1609
1607
1610
int LSAPI_Finish_r ( LSAPI_Request * pReq )
@@ -1622,7 +1625,7 @@ int LSAPI_Finish_r( LSAPI_Request * pReq )
1622
1625
Flush_RespBuf_r ( pReq );
1623
1626
}
1624
1627
1625
- pReq -> m_pIovecCur -> iov_base = (void * )& finish ;
1628
+ pReq -> m_pIovecCur -> iov_base = (void * )finish_close ;
1626
1629
pReq -> m_pIovecCur -> iov_len = LSAPI_PACKET_HEADER_LEN ;
1627
1630
pReq -> m_totalLen += LSAPI_PACKET_HEADER_LEN ;
1628
1631
++ pReq -> m_pIovecCur ;
@@ -1638,27 +1641,31 @@ int LSAPI_End_Response_r(LSAPI_Request * pReq)
1638
1641
{
1639
1642
if (!pReq )
1640
1643
return -1 ;
1644
+ if (pReq -> m_reqState & LSAPI_ST_BACKGROUND )
1645
+ return 0 ;
1641
1646
if (pReq -> m_reqState )
1642
1647
{
1643
1648
if ( pReq -> m_fd != -1 )
1644
1649
{
1645
1650
if ( pReq -> m_reqState & LSAPI_ST_RESP_HEADER )
1646
1651
{
1652
+ if ( pReq -> m_pRespHeaderBufPos <= pReq -> m_pRespHeaderBuf )
1653
+ return 0 ;
1654
+
1647
1655
LSAPI_FinalizeRespHeaders_r ( pReq );
1648
1656
}
1649
1657
if ( pReq -> m_pRespBufPos != pReq -> m_pRespBuf )
1650
1658
{
1651
1659
Flush_RespBuf_r ( pReq );
1652
1660
}
1653
1661
1654
- pReq -> m_pIovecCur -> iov_base = (void * )& finish ;
1655
- pReq -> m_pIovecCur -> iov_len = LSAPI_PACKET_HEADER_LEN ;
1656
- pReq -> m_totalLen += LSAPI_PACKET_HEADER_LEN ;
1662
+ pReq -> m_pIovecCur -> iov_base = (void * )finish_close ;
1663
+ pReq -> m_pIovecCur -> iov_len = LSAPI_PACKET_HEADER_LEN << 1 ;
1664
+ pReq -> m_totalLen += LSAPI_PACKET_HEADER_LEN << 1 ;
1657
1665
++ pReq -> m_pIovecCur ;
1658
1666
LSAPI_Flush_r ( pReq );
1667
+ lsapi_close_connection (pReq );
1659
1668
}
1660
- send_conn_close_notification (pReq -> m_fd );
1661
- lsapi_close_connection (pReq );
1662
1669
pReq -> m_reqState |= LSAPI_ST_BACKGROUND ;
1663
1670
}
1664
1671
return 0 ;
@@ -3163,8 +3170,8 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer,
3163
3170
3164
3171
#if defined(linux ) || defined(__linux ) || defined(__linux__ ) || defined(__gnu_linux__ )
3165
3172
* s_avail_pages = sysconf (_SC_AVPHYS_PAGES );
3166
- lsapi_log ("Memory total: %zd, free: %zd, free %%%zd\n" ,
3167
- s_total_pages , * s_avail_pages , * s_avail_pages * 100 / s_total_pages );
3173
+ // lsapi_log("Memory total: %zd, free: %zd, free %%%zd\n",
3174
+ // s_total_pages, *s_avail_pages, *s_avail_pages * 100 / s_total_pages);
3168
3175
3169
3176
#endif
3170
3177
FD_ZERO ( & readfds );
0 commit comments