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; } }
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; } }
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; } }
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; }