static void createServer(struct _TServer ** const srvPP, bool const noAccept, TChanSwitch * const chanSwitchP, bool const userChanSwitch, unsigned short const portNumber, const char ** const errorP) { struct _TServer * srvP; MALLOCVAR(srvP); if (srvP == NULL) { xmlrpc_asprintf(errorP, "Unable to allocate space for server descriptor"); } else { setupTrace(srvP); srvP->terminationRequested = false; initChanSwitchStuff(srvP, noAccept, chanSwitchP, userChanSwitch, portNumber, errorP); if (!*errorP) { srvP->builtinHandlerP = HandlerCreate(); if (!srvP->builtinHandlerP) xmlrpc_asprintf(errorP, "Unable to allocate space for " "builtin handler descriptor"); else { srvP->defaultHandler = HandlerDefaultBuiltin; srvP->defaultHandlerContext = srvP->builtinHandlerP; srvP->name = strdup("unnamed"); srvP->logfilename = NULL; srvP->keepalivetimeout = 15; srvP->keepalivemaxconn = 30; srvP->timeout = 15; srvP->advertise = TRUE; srvP->useSigchld = FALSE; srvP->uriHandlerStackSize = 0; srvP->maxConn = 15; srvP->maxConnBacklog = 15; initUnixStuff(srvP); ListInitAutoFree(&srvP->handlers); srvP->logfileisopen = FALSE; *errorP = NULL; if (*errorP) HandlerDestroy(srvP->builtinHandlerP); } } if (*errorP) free(srvP); } *srvPP = srvP; }
static void createServer(struct _TServer ** const srvPP, abyss_bool const noAccept, TSocket * const userSocketP, uint16_t const portNumber, const char ** const errorP) { struct _TServer * srvP; MALLOCVAR(srvP); if (srvP == NULL) { xmlrpc_asprintf(errorP, "Unable to allocate space for server descriptor"); } else { srvP->terminationRequested = false; initSocketStuff(srvP, noAccept, userSocketP, portNumber, errorP); if (!*errorP) { srvP->defaulthandler = ServerDefaultHandlerFunc; srvP->name = strdup("unnamed"); srvP->filespath = strdup(DEFAULT_DOCS); srvP->logfilename = NULL; srvP->keepalivetimeout = 15; srvP->keepalivemaxconn = 30; srvP->timeout = 15; srvP->advertise = TRUE; srvP->mimeTypeP = NULL; srvP->useSigchld = FALSE; initUnixStuff(srvP); ListInitAutoFree(&srvP->handlers); ListInitAutoFree(&srvP->defaultfilenames); srvP->logfileisopen = FALSE; *errorP = NULL; } if (*errorP) free(srvP); } *srvPP = srvP; }