Procházet zdrojové kódy

Added function http_redo, which does a new request for the same url as an

old request and cancels the old request.
master
Richard Nyberg před 19 roky
rodič
revize
0c71b0ceb1
2 změnil soubory, kde provedl 12 přidání a 0 odebrání
  1. +11
    -0
      btpd/http.c
  2. +1
    -0
      btpd/http.h

+ 11
- 0
btpd/http.c Zobrazit soubor

@@ -88,6 +88,17 @@ http_get(struct http **ret,
return 0; return 0;
} }


int
http_redo(struct http **http)
{
int err;
struct http *ret;
err = http_get(&ret, (*http)->cb, "%s", (*http)->url);
http_cancel(*http);
*http = ret;
return err;
}

void void
http_cancel(struct http *http) http_cancel(struct http *http)
{ {


+ 1
- 0
btpd/http.h Zobrazit soubor

@@ -20,6 +20,7 @@ int http_get(struct http **ret,
void (*cb)(struct http *, struct http_res *, void *), void (*cb)(struct http *, struct http_res *, void *),
void *arg, void *arg,
const char *fmt, ...); const char *fmt, ...);
int http_redo(struct http **http);
void http_cancel(struct http *http); void http_cancel(struct http *http);


int http_succeeded(struct http_res *res); int http_succeeded(struct http_res *res);


||||||
x
 
000:0
Načítá se…
Zrušit
Uložit