(socket server) do not create a select interrupt object everytime when polling for notifications while waiting for new connections, instead use a persistent one which is a member variable
This commit is contained in:
		@@ -27,8 +27,6 @@ namespace ix
 | 
			
		||||
{
 | 
			
		||||
    const int Socket::kDefaultPollNoTimeout = -1; // No poll timeout by default
 | 
			
		||||
    const int Socket::kDefaultPollTimeout = kDefaultPollNoTimeout;
 | 
			
		||||
    const uint64_t Socket::kSendRequest = 1;
 | 
			
		||||
    const uint64_t Socket::kCloseRequest = 2;
 | 
			
		||||
    constexpr size_t Socket::kChunkSize;
 | 
			
		||||
 | 
			
		||||
    Socket::Socket(int fd)
 | 
			
		||||
@@ -96,11 +94,11 @@ namespace ix
 | 
			
		||||
        {
 | 
			
		||||
            uint64_t value = selectInterrupt->read();
 | 
			
		||||
 | 
			
		||||
            if (value == kSendRequest)
 | 
			
		||||
            if (value == SelectInterrupt::kSendRequest)
 | 
			
		||||
            {
 | 
			
		||||
                pollResult = PollResultType::SendRequest;
 | 
			
		||||
            }
 | 
			
		||||
            else if (value == kCloseRequest)
 | 
			
		||||
            else if (value == SelectInterrupt::kCloseRequest)
 | 
			
		||||
            {
 | 
			
		||||
                pollResult = PollResultType::CloseRequest;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user