예제 #1
0
static FskErr sHTTPServerGotSocket(struct FskSocketRecord *skt, void *refCon) {
	FskHTTPServerListener listener = (FskHTTPServerListener)refCon;
	listener->handshaking = false;
	if (listener->http && FskNetSocketGetLastError(skt) == kFskErrNone)
		return httpServerListenerStart(listener, skt);
	else {
		FskHTTPServerListenerDispose(listener);
		return kFskErrOperationFailed;
	}
}
예제 #2
0
void httpServerInterfaceDown(FskHTTPServer http, char *ifcName) {
	FskHTTPServerListener cur = http->listeners, next = NULL;

	FskInstrumentedTypePrintfDebug(&gFskHTTPServerTypeInstrumentation, "httpServerInterfaceDown - ifcName: %p\n", ifcName);
	if (ifcName == NULL) return;

	while (cur) {
		next = cur->next;
		if (0 == FskStrCompare(cur->ifcName, ifcName)) {
			FskHTTPServerListenerDispose(cur);
		}
		cur = next;
	}
}
예제 #3
0
static FskErr sHTTPServerGotSocket(struct FskSocketRecord *skt, void *refCon) {
	FskHTTPServerListener listener = (FskHTTPServerListener)refCon;
	listener->handshaking = false;
	FskErr err = skt != NULL ? FskNetSocketGetLastError(skt) : kFskErrOperationFailed;
	if (listener->http && err == kFskErrNone)
		return httpServerListenerStart(listener, skt);
	else {
		if (skt != NULL)
			FskNetSocketClose(skt);
		if (err != kFskErrSSLHandshakeFailed)
			FskHTTPServerListenerDispose(listener);
		return err;
	}
}
예제 #4
0
FskErr FskHTTPServerDispose(FskHTTPServer http) {
	FskInstrumentedTypePrintfDebug(&gFskHTTPServerTypeInstrumentation, "FskHTTPServerDispose %p  - useCount: %d\n", http, http ? http->useCount : 0);
	if (http) {
		// remove existing requests
		while (http->activeRequests) {
			FskHTTPServerRequest request = http->activeRequests;
			FskInstrumentedItemSendMessage(request, kFskHTTPInstrMsgRequestRemainsOnClose, request);
			if (kFskErrNone != doCallCondition(http->callbacks->requestCondition, request, kFskHTTPConditionConnectionTerminating, request->refCon))
				FskHTTPServerRequestDispose(request);
		}

		FskNetInterfaceRemoveNotifier(http->interfaceNotifier);
		while (http->listeners)
			FskHTTPServerListenerDispose(http->listeners);

		sFskHTTPServerDownUse(http);
	}
	return kFskErrNone;
}