Closed GoogleCodeExporter closed 9 years ago
Original comment by igagis@gmail.com
on 29 Nov 2010 at 3:27
Test code demonstrating the error:
{
ting::SocketLib socketsLib;
ting::IPAddress ip = socketsLib.GetHostByName("www.google.com", 80);
ting::TCPSocket sock;
sock.Open(ip);
const char * reqs = "GET / HTTP/1.1\r\nHost:
www.google.com\r\nConnection:close\r\n\r\n";
ting::Buffer<ting::u8> req( (ting::u8*) reqs , strlen(reqs) );
sock.SendAll( req );
ting::StaticBuffer<ting::u8,1024> respBuf;
ting::WaitSet waitSet(1);
waitSet.Add(&sock, ting::Waitable::READ);
waitSet.Wait(false,2000,NULL);
CHECK( sock.CanRead() );
int read = sock.Recv(respBuf,0);
sock.Close();
LOG_DEBUG<<"Ready for crash"; //-------- CRASH ON NEXT LINE
waitSet.Remove(&sock);
LOG_DEBUG<<"we never get here"; //------------------------
}
Original comment by igagis@gmail.com
on 2 Dec 2010 at 1:35
Looks like, due to implementation specifics, it is not possible to fix this.
Only opened and not closed Sockets are allowed to be in the WaitSet.
I have added more informative asserts to catch wrong cases.
Not closing this bug so far, cause it still may be resolved in some far future.
Setting bug priority to "low".
Original comment by igagis@gmail.com
on 28 Dec 2010 at 4:03
After some thinking I came to the conclusion that such use case contradicts to
the conception of ting sockets. When socket is closed it becomes invalid.
Invalid socket cannot belong to a WaitSet.
Assertions were added to catch such cases of incorrect usage.
Closing bug as invalid.
Original comment by igagis@gmail.com
on 30 Mar 2011 at 7:35
Original issue reported on code.google.com by
juan...@gmail.com
on 29 Nov 2010 at 3:01