View Single Post
  #2 (permalink)  
Old February 24th, 2002
maksik maksik is offline
Mutella Developer
 
Join Date: January 30th, 2002
Location: Germany
Posts: 87
maksik is flying high
Default

General answer: I haven't chosen those tactics, I've inherited it from Gnucleus with other bits of crap here and there and trying to clean up the code without breaking everything since day 1. So, IMHO the question should be addressed to the developers of Gnucleus

but, ok step by step:
a) MGnuSocket is a bit special type of socket, it's an incomming connection with yet undefined type. That is the other side did not initiated handshake yet. There is certain timeout while it makes sence to wait for a handshake, and when it's over the socket has to go. At the moment the implementation is ugly but it improves (v0.4 is somewhere on the way)

b) Historical reason. probably have to review it.

c,d) In principle it seems to make sence to remove all sockets only here, that is in
OnTimer()

Quote:
void MGnuSock::OnReceive()
DWORD dwBuffLength = Receive(m_pBuff, 32768);
see the begining of the message. Btw, it's gone in the current version (will be on CVS probably on Thursday)

Quote:
- Server socket class destructor should clean up also m_SockList?
this is right, but the current implementation only will produce memory leaks on application exit, which is not that important

Quote:
- All socket classes destructors should do this: if (m_hSocket != INVALID_SOCKET) Close();
something like that is already done in the MAsyncSocket's destructor

Quote:
- Closing sockets should be more friendly, a ForceDisconnect should only used if necesarry.
In general -- agree. Say "Shutdown" and than after few seconds "Close".

Thanks for the comments,
Guess on day I'll have time to complete and clean up all this mess...

--Max
Reply With Quote