RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 21-Mar-2010 01:26:37 Branch: HEAD Handle: 2010032100263700 Modified files: rpm/rpmio rpmdav.c rpmio_internal.h Log: - rpmdav: use urlType(u) where needed. - rpmio: eliminate fd->urltype, use urlType(fd->u) getter instead. Summary: Revision Changes Path 2.115 +33 -21 rpm/rpmio/rpmdav.c 2.126 +1 -2 rpm/rpmio/rpmio_internal.h ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/rpmio/rpmdav.c ============================================================================ $ cvs diff -u -r2.114 -r2.115 rpmdav.c --- rpm/rpmio/rpmdav.c 17 Mar 2010 16:11:46 -0000 2.114 +++ rpm/rpmio/rpmdav.c 21 Mar 2010 00:26:37 -0000 2.115 @@ -115,16 +115,14 @@ /*...@-mustmod@*/ int davDisconnect(/*...@unused@*/ void * _u) { -#ifdef NOTYET /* XXX not quite right yet. */ urlinfo u = (urlinfo)_u; - int rc; + int rc = 0; #if WITH_NEON_MIN_VERSION >= 0x002700 rc = (u->info.status == ne_status_sending || u->info.status == ne_status_recving); -#else - rc = 0; /* XXX W2DO? */ #endif - if (u != NULL && rc != 0) { + if (u != NULL) { +#ifdef NOTYET if (u->ctrl->req != NULL) { if (u->ctrl && u->ctrl->req) { ne_request_destroy(u->ctrl->req); @@ -135,11 +133,16 @@ u->data->req = NULL; } } +#else +#ifdef STILL_NOTYET /* XXX closer but no cigar */ + if (u->sess != NULL) + ne_close_connection(u->sess); +#endif +#endif } DAVDEBUG(-1, (stderr, "<-- %s(%p) active %d\n", __FUNCTION__, u, rc)); - /* XXX return active state? */ -#endif /* NOTYET */ - return 0; + rc = 0; /* XXX return active state? */ + return rc; } /*...@=mustmod@*/ @@ -150,7 +153,7 @@ ne_session_destroy(u->sess); u->sess = NULL; } - switch (u->urltype) { + switch (urlType(u)) { default: /*...@notreached@*/ break; case URL_IS_HTTPS: @@ -443,8 +446,15 @@ int rc; /* HACK: hkp:// has no steenkin' options */ - if (!(u->urltype == URL_IS_HTTP || u->urltype == URL_IS_HTTPS)) + switch (urlType(u)) { + case URL_IS_HKP: + default: return 0; + /*...@notreached@*/ break; + case URL_IS_HTTP: + case URL_IS_HTTPS: + break; + } /* HACK: where should server capabilities be read? */ (void) urlPath(u->url, &path); @@ -536,9 +546,9 @@ /*...@=globs@*/ if (u->url != NULL && u->sess == NULL) - switch (u->urltype) { + switch (u->ut) { default: - assert(u->urltype != u->urltype); + assert(u->ut != u->ut); /*...@notreached@*/ break; case URL_IS_HTTPS: case URL_IS_HTTP: @@ -1678,6 +1688,8 @@ { int rc = 0; +DAVDEBUG(-1, (stderr, "--> %s(%p,%p,%p) sess %p req %p\n", __FUNCTION__, u, ctrl, str, u->sess, ctrl->req)); + rc = ne_begin_request(ctrl->req); rc = my_result("ne_begin_req(ctrl->req)", rc, NULL); @@ -1699,7 +1711,7 @@ int rc = 0; assert(ctrl != NULL); - u = ctrl->url; + u = ctrl->u; URLSANE(u); DAVDEBUG(-1, (stderr, "--> %s(%p,%s,\"%s\") entry sess %p req %p\n", __FUNCTION__, ctrl, httpCmd, (httpArg ? httpArg : ""), u->sess, ctrl->req)); @@ -1808,7 +1820,7 @@ /*...@unused@*/ mode_t mode, /*...@out@*/ urlinfo * uret) { const char * path = NULL; - urltype urlType = urlPath(url, &path); + urltype ut = urlPath(url, &path); urlinfo u = NULL; FD_t fd = NULL; int rc; @@ -1832,9 +1844,9 @@ yarnRelease(use); } - if (u->ctrl->url == NULL) + if (u->ctrl->u == NULL) fd = u->ctrl = fdLink(u->ctrl, "grab ctrl (davOpen persist ctrl)"); - else if (u->data->url == NULL) + else if (u->data->u == NULL) fd = u->data = fdLink(u->data, "grab ctrl (davOpen persist data)"); else fd = fdNew("grab ctrl (davOpen)"); @@ -1846,9 +1858,8 @@ fd->ftpFileDoneNeeded = 0; fd->rd_timeoutsecs = rpmioHttpReadTimeoutSecs; fd->contentLength = fd->bytesRemain = -1; -assert(urlType == URL_IS_HTTPS || urlType == URL_IS_HTTP || urlType == URL_IS_HKP); - fd->urlType = urlType; - fd->url = urlLink(u, "url (davOpen)"); +assert(ut == URL_IS_HTTPS || ut == URL_IS_HTTP || ut == URL_IS_HKP); + fd->u = urlLink(u, "url (davOpen)"); fd = fdLink(fd, "grab data (davOpen)"); } @@ -1868,7 +1879,7 @@ #if WITH_NEON_MIN_VERSION >= 0x002700 { urlinfo u = NULL; - u = urlLink(fd->url, "url (davRead)"); + u = urlLink(fd->u, "url (davRead)"); if (u->info.status == ne_status_recving) rc = ne_read_response_block(fd->req, buf, count); else { @@ -1947,6 +1958,8 @@ /*...@=onlytrans@*/ int rc = 0; +DAVDEBUG(-1, (stderr, "--> %s(%p) rc %d clen %d req %p u %p\n", __FUNCTION__, fd, rc, fd->bytesRemain, fd->req, fd->u)); + assert(fd->req != NULL); if (fd->req != (void *)-1) { rc = ne_end_request(fd->req); @@ -2216,7 +2229,6 @@ fd->contentLength = fd->bytesRemain = -1; fd->url = urlLink(u, "url (httpOpen)"); fd = fdLink(fd, "grab data (httpOpen)"); - fd->urlType = URL_IS_HTTP; } exit: @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmio_internal.h ============================================================================ $ cvs diff -u -r2.125 -r2.126 rpmio_internal.h --- rpm/rpmio/rpmio_internal.h 10 Dec 2009 18:47:58 -0000 2.125 +++ rpm/rpmio/rpmio_internal.h 21 Mar 2010 00:26:37 -0000 2.126 @@ -65,10 +65,9 @@ #define FDMAGIC 0x04463138 int nfps; FDSTACK_t fps[8]; - int urlType; /* ufdio: */ /*...@dependent@*/ /*...@relnull@*/ - void * url; /* ufdio: URL info */ + void * u; /* ufdio: URL info */ /*...@relnull@*/ void * req; /* ufdio: HTTP request */ @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org