浏览代码

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 18 年前
父节点
当前提交
0c71b0ceb1
共有 2 个文件被更改,包括 12 次插入0 次删除
  1. +11
    -0
      btpd/http.c
  2. +1
    -0
      btpd/http.h

+ 11
- 0
btpd/http.c 查看文件

@@ -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 查看文件

@@ -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);


正在加载...
取消
保存