* BUG: Some little fixes related to r7748.


git-svn-id: svn://localhost/gambas/trunk@7749 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2016-05-02 21:49:42 +00:00
parent 89339bf9d5
commit 6f80d00888

View file

@ -155,19 +155,25 @@ void CSocket_post_connected(void *_object)
static void CSocket_close(CSOCKET *_object)
{
int fd;
if (THIS->DnsTool)
{
dns_close_all(THIS->DnsTool);
GB.Unref(POINTER(&THIS->DnsTool));
THIS->DnsTool=NULL;
THIS->DnsTool = NULL;
}
if (SOCKET->status > NET_INACTIVE) /* if it's not connected, does nothing */
{
GB.Watch(SOCKET->socket , GB_WATCH_NONE , (void *)CSocket_CallBack,0);
SOCKET->stream.desc = NULL;
close(SOCKET->socket);
fd = SOCKET->socket;
//fprintf(stderr, "CSocket_close: %p: set fd %d to -1\n", THIS, fd);
SOCKET->socket = -1;
GB.Watch(fd , GB_WATCH_NONE, NULL, 0);
SOCKET->stream.desc = NULL;
close(fd);
set_status(THIS, NET_INACTIVE);
}
@ -221,6 +227,7 @@ void CSocket_CallBackFromDns(void *_object)
GB.Watch(SOCKET->socket , GB_WATCH_NONE, NULL, 0);
SOCKET->stream.desc = NULL;
close(SOCKET->socket);
SOCKET->socket = -1;
set_status(THIS, NET_INACTIVE);
}