Esempio n. 1
0
void NetlibDoClose(NetlibConnection *nlc, bool noShutdown)
{
	NetlibLogf(nlc->nlu, "(%p:%u) Connection closed internal", nlc, nlc->s);
	if (nlc->hSsl)
	{
		if (!noShutdown) si.shutdown(nlc->hSsl);
		si.sfree(nlc->hSsl);
		nlc->hSsl = NULL;
	}
	if (nlc->s != INVALID_SOCKET) closesocket(nlc->s);
	nlc->s = INVALID_SOCKET;
}
Esempio n. 2
0
INT_PTR NetlibShutdown(WPARAM wParam, LPARAM)
{
	if (wParam) 
	{
		WaitForSingleObject(hConnectionHeaderMutex,INFINITE);
		switch(GetNetlibHandleType(wParam)) {
			case NLH_CONNECTION:
				{
					struct NetlibConnection* nlc = (struct NetlibConnection*)wParam;
					if (nlc->hSsl) si.shutdown(nlc->hSsl);
					if (nlc->s != INVALID_SOCKET) shutdown(nlc->s, 2);
					if (nlc->s2 != INVALID_SOCKET) shutdown(nlc->s2, 2);
					nlc->termRequested = true;
				}
				break;
			case NLH_BOUNDPORT:
				{
					struct NetlibBoundPort* nlb = (struct NetlibBoundPort*)wParam;
					if (nlb->s != INVALID_SOCKET) shutdown(nlb->s, 2);
				}
				break;
		}
		ReleaseMutex(hConnectionHeaderMutex);

	}
	return 0;
}