f683064dc6a998206665b484790ef9d561e6c8a7 markd Sat Dec 5 22:42:53 2020 -0800 initial conversion to gfServer connection to object diff --git src/jkOwnLib/gfPcrLib.c src/jkOwnLib/gfPcrLib.c index 1f0934a..c1b5961 100644 --- src/jkOwnLib/gfPcrLib.c +++ src/jkOwnLib/gfPcrLib.c @@ -446,63 +446,64 @@ if (strand == '-') pcrLocalStrand(pcrName, seq, seqOffset, seqName, seqSize, maxSize, rPrimer, rPrimerSize, fPrimer, fPrimerSize, minPerfect, minGood, strand, pOutList); else pcrLocalStrand(pcrName, seq, seqOffset, seqName, seqSize, maxSize, fPrimer, fPrimerSize, rPrimer, rPrimerSize, minPerfect, minGood, strand, pOutList); } struct gfRange *gfPcrGetRanges(char *host, char *port, char *fPrimer, char *rPrimer, int maxSize) /* Query gfServer with primers and convert response to a list of gfRanges. */ { char buf[256]; -int conn = gfConnect(host, port); +struct gfConnection *conn = gfConnect(host, port); struct gfRange *rangeList = NULL, *range; /* Query server and put results into rangeList. */ safef(buf, sizeof(buf), "%spcr %s %s %d", gfSignature(), fPrimer, rPrimer, maxSize); -mustWriteFd(conn, buf, strlen(buf)); +mustWriteFd(conn->fd, buf, strlen(buf)); for (;;) { - if (netGetString(conn, buf) == NULL) + if (netGetString(conn->fd, buf) == NULL) break; if (sameString(buf, "end")) break; else if (startsWith("Error:", buf)) errAbort("%s", buf); else { char *s = buf; char *name, *start, *end, *strand; name = nextWord(&s); start = nextWord(&s); end = nextWord(&s); strand = nextWord(&s); if (strand == NULL) errAbort("Truncated gfServer response"); AllocVar(range); range->tName = cloneString(name); range->tStart = atoi(start); range->tEnd = atoi(end); range->tStrand = strand[0]; slAddHead(&rangeList, range); } } -close(conn); +close(conn->fd); +conn->fd = -1; slReverse(&rangeList); return rangeList; } static void gfPcrOneViaNet( char *host, char *port, char *seqDir, char *pcrName, char *fPrimer, char *rPrimer, int maxSize, int minPerfect, int minGood, struct hash *tFileCache, struct gfPcrOutput **pOutList) /* Query gfServer for likely primer hits, load DNA to do detailed * examination, and output hits to head of *pOutList.. */ { struct gfRange *rangeList = NULL, *range; int fPrimerSize = strlen(fPrimer); int rPrimerSize = strlen(rPrimer);