Added NetDescriptor_detach()

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2638 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
Meep-Eep
2006-12-30 13:03:55 +00:00
parent 6dcf79e1df
commit 28cdc3c777
2 changed files with 10 additions and 0 deletions
@@ -138,6 +138,15 @@ NetDescriptor_decRef(NetDescriptor *nd) {
return false;
}
// The socket will no longer be managed by the NetManager.
void
NetDescriptor_detach(NetDescriptor *nd) {
NetManager_removeDesc(nd);
nd->socket = Socket_noSocket;
nd->flags.closed = true;
NetDescriptor_decRef(nd);
}
Socket *
NetDescriptor_getSocket(NetDescriptor *nd) {
return nd->socket;
@@ -63,6 +63,7 @@ NetDescriptor *NetDescriptor_new(Socket *socket, void *extra);
void NetDescriptor_close(NetDescriptor *nd);
void NetDescriptor_incRef(NetDescriptor *nd);
bool NetDescriptor_decRef(NetDescriptor *nd);
void NetDescriptor_detach(NetDescriptor *nd);
Socket *NetDescriptor_getSocket(NetDescriptor *nd);
void NetDescriptor_setExtra(NetDescriptor *nd, void *extra);
void *NetDescriptor_getExtra(const NetDescriptor *nd);