-
- /* Use the string tokenizer to grab one line at a time */
- for (i=0; i<num_tokens(working_ignetcfg, '\n'); ++i) {
- if(server_shutting_down)
- return;
- extract_token(linebuf, working_ignetcfg, i, '\n', sizeof linebuf);
- extract_token(node, linebuf, 0, '|', sizeof node);
- extract_token(secret, linebuf, 1, '|', sizeof secret);
- extract_token(host, linebuf, 2, '|', sizeof host);
- extract_token(port, linebuf, 3, '|', sizeof port);
- if ( !IsEmptyStr(node) && !IsEmptyStr(secret)
- && !IsEmptyStr(host) && !IsEmptyStr(port)) {
- poll = full_poll;
- if (poll == 0) {
- snprintf(spoolfile,
- sizeof spoolfile,
- "%s/%s",
- ctdl_netout_dir,
- node
- );
- if (access(spoolfile, R_OK) == 0) {
- poll = 1;
+ CfgData = NewStrBufPlain(working_ignetcfg, -1);
+ Line = NewStrBufPlain(NULL, StrLength(CfgData));
+ Done = 0;
+ CfgPtr = NULL;
+ while (!Done)
+ {
+ /* Use the string tokenizer to grab one line at a time */
+ StrBufSipLine(Line, CfgData, &CfgPtr);
+ Done = CfgPtr == StrBufNOTNULL;
+ if (StrLength(Line) > 0)
+ {
+ if(server_shutting_down)
+ return;/* TODO free stuff*/
+ lptr = NULL;
+ poll = 0;
+ NW = (AsyncNetworker*)malloc(sizeof(AsyncNetworker));
+ memset(NW, 0, sizeof(AsyncNetworker));
+
+ NW->node = NewStrBufPlain(NULL, StrLength(Line));
+ NW->host = NewStrBufPlain(NULL, StrLength(Line));
+ NW->port = NewStrBufPlain(NULL, StrLength(Line));
+ NW->secret = NewStrBufPlain(NULL, StrLength(Line));
+
+ StrBufExtract_NextToken(NW->node, Line, &lptr, '|');
+ StrBufExtract_NextToken(NW->secret, Line, &lptr, '|');
+ StrBufExtract_NextToken(NW->host, Line, &lptr, '|');
+ StrBufExtract_NextToken(NW->port, Line, &lptr, '|');
+ if ( (StrLength(NW->node) != 0) &&
+ (StrLength(NW->secret) != 0) &&
+ (StrLength(NW->host) != 0) &&
+ (StrLength(NW->port) != 0))
+ {
+ poll = full_poll;
+ if (poll == 0)
+ {
+ NW->SpoolFileName = NewStrBufPlain(ctdl_netout_dir, -1);
+ StrBufAppendBufPlain(NW->SpoolFileName, HKEY("/"), 0);
+ StrBufAppendBuf(NW->SpoolFileName, NW->node, 0);
+ if (access(ChrPtr(NW->SpoolFileName), R_OK) == 0) {
+ poll = 1;
+ }