Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » Skylark logs failure in accept()
Re: Skylark logs failure in accept() [message #37161 is a reply to message #37160] Sun, 02 September 2012 08:59 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
Interesting.

I think it is caused by something wrong in our emulation of "blocking" accept.

bool TcpSocket::Accept(TcpSocket& ls)
{
	Close();
	Init();
	Reset();
	ASSERT(ls.IsOpen());
	if(timeout) { // <<< Timeout should be Null
		int h = ls.GetTimeout();
		bool b = ls.Timeout(timeout).Wait(WAIT_READ, GetEndTime()); // <<< This should do the waiting until some request is available
		ls.Timeout(h);
		if(!b)
			return false;
	}
	socket = accept(ls.GetSOCKET(), NULL, NULL);
	if(socket == INVALID_SOCKET) {
		SetSockError("accept");
		return false;
	}
	mode = ACCEPT;
	return SetupSocket();
}


Basically, error reported is EAGAIN, which is sort of "non-error", it only means that operation should be performed again later. But it should not happen anyway...

On the other way, if there is a "legal" way how it can get EAGAIN there, easy fix would be to return false for EAGAIN and timeout not Null and to loop back if timeout is Null (to be blocking).

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [Solved]Can't show favicon.ico in Skylark if root path is not Null
Next Topic: TcpSocket in Array
Goto Forum:
  


Current Time: Tue Aug 26 09:39:14 CEST 2025

Total time taken to generate the page: 0.05371 seconds