Mercurial > noffle
comparison src/request.c @ 185:fed1334d766b noffle
[svn] * src/client.c: Change variable only used on constant to 'const'.
* src/filter.c: Add a couple of 'return's after ASSERT() to remove
compiler warnings about functions needing returns.
* NEWS,TODO,configure,configure.in,noffle.conf.example,docs/NOTES,
docs/noffle.conf.5,src/client.c,src/configfile.c,src/content.c,
src/control.c,src/database.c,src/fetch.c,src/fetchlist.c,src/filter.c,
src/group.c,src/lock.c,src/log.c,src/log.h,src/noffle.c,src/outgoing.c,
src/post.c,src/protocol.c,src/request.c,src/server.c,src/util.c:
Debug logging is always compiled and selected via noffle.conf. All debug
logs are classified as all, none, config, control, expire, fetch,
filter, newsbase, noffle, post, protocol, requests and server.
author | bears |
---|---|
date | Sun, 05 Aug 2001 09:24:22 +0100 |
parents | cfad9678e286 |
children | 24d4cd032da5 |
comparison
equal
deleted
inserted
replaced
184:9854ea5f295f | 185:fed1334d766b |
---|---|
1 /* | 1 /* |
2 request.c | 2 request.c |
3 | 3 |
4 Collection of articles that are marked for download. | 4 Collection of articles that are marked for download. |
5 | 5 |
6 $Id: request.c 178 2000-07-22 09:04:20Z enz $ | 6 $Id: request.c 300 2001-08-05 08:24:22Z bears $ |
7 */ | 7 */ |
8 | 8 |
9 #if HAVE_CONFIG_H | 9 #if HAVE_CONFIG_H |
10 #include <config.h> | 10 #include <config.h> |
11 #endif | 11 #endif |
204 { | 204 { |
205 Str filename; | 205 Str filename; |
206 FILE* file; | 206 FILE* file; |
207 | 207 |
208 fileRequest(filename, rs->serv); | 208 fileRequest(filename, rs->serv); |
209 Log_dbg("appending to request file %s", filename); | 209 Log_dbg( LOG_DBG_REQUESTS, "appending to request file %s", filename ); |
210 | 210 |
211 if (Log_check((file = fopen(filename, "a")) != 0, | 211 if (Log_check((file = fopen(filename, "a")) != 0, |
212 "could not open %s for appending: %s", | 212 "could not open %s for appending: %s", |
213 filename, strerror(errno))) | 213 filename, strerror(errno))) |
214 return FALSE; | 214 return FALSE; |
232 */ | 232 */ |
233 Bool Req_add(const char *serv, const char *msgId) | 233 Bool Req_add(const char *serv, const char *msgId) |
234 { | 234 { |
235 Reqserv* rs; | 235 Reqserv* rs; |
236 ASSERT( is_open ); | 236 ASSERT( is_open ); |
237 Log_dbg( "Marking %s on %s for download", msgId, serv ); | 237 Log_dbg( LOG_DBG_REQUESTS, "Marking %s on %s for download", msgId, serv ); |
238 | 238 |
239 if (getReqserv(serv, &rs) == FALSE) | 239 if (getReqserv(serv, &rs) == FALSE) |
240 return FALSE; | 240 return FALSE; |
241 if (storeMsgId(rs, msgId) == FALSE) /* already recorded */ | 241 if (storeMsgId(rs, msgId) == FALSE) /* already recorded */ |
242 return TRUE; | 242 return TRUE; |
266 Str line; | 266 Str line; |
267 FILE* file; | 267 FILE* file; |
268 Reqserv* rs; | 268 Reqserv* rs; |
269 | 269 |
270 fileRequest(filename, serv); | 270 fileRequest(filename, serv); |
271 Log_dbg("reading request file %s", filename); | 271 Log_dbg( LOG_DBG_REQUESTS, "reading request file %s", filename ); |
272 | 272 |
273 file = fopen(filename, "r"); | 273 file = fopen(filename, "r"); |
274 if (!file && (errno == ENOENT)) { | 274 if (!file && (errno == ENOENT)) { |
275 *rsz = newReqserv(serv); | 275 *rsz = newReqserv(serv); |
276 (*rsz)->mtime = get_mtime(serv); | 276 (*rsz)->mtime = get_mtime(serv); |
308 Str filename; | 308 Str filename; |
309 FILE* file; | 309 FILE* file; |
310 char** z; | 310 char** z; |
311 | 311 |
312 fileRequest(filename, rs->serv); | 312 fileRequest(filename, rs->serv); |
313 Log_dbg("writing request file %s", filename); | 313 Log_dbg( LOG_DBG_REQUESTS, "writing request file %s", filename ); |
314 | 314 |
315 if (Log_check((file = fopen(filename, "w")) != 0, | 315 if (Log_check((file = fopen(filename, "w")) != 0, |
316 "could not open %s for writing: %s", | 316 "could not open %s for writing: %s", |
317 filename, strerror(errno))) | 317 filename, strerror(errno))) |
318 return FALSE; | 318 return FALSE; |
343 { | 343 { |
344 Reqserv* rs; | 344 Reqserv* rs; |
345 char** z; | 345 char** z; |
346 | 346 |
347 ASSERT( is_open ); | 347 ASSERT( is_open ); |
348 Log_dbg("Req_remove(\"%s\", \"%s\")", serv, msgId); | 348 Log_dbg( LOG_DBG_REQUESTS, "Req_remove(\"%s\", \"%s\")", serv, msgId ); |
349 | 349 |
350 if (getReqserv(serv, &rs) == FALSE) | 350 if (getReqserv(serv, &rs) == FALSE) |
351 return; | 351 return; |
352 | 352 |
353 z = searchMsgId(rs, msgId); | 353 z = searchMsgId(rs, msgId); |
410 changed recently, from cache. These files will be reread on demand. | 410 changed recently, from cache. These files will be reread on demand. |
411 */ | 411 */ |
412 Bool | 412 Bool |
413 Req_open(void) | 413 Req_open(void) |
414 { | 414 { |
415 Log_dbg("opening request database"); | 415 Log_dbg( LOG_DBG_REQUESTS, "opening request database" ); |
416 ASSERT(is_open == FALSE); | 416 ASSERT(is_open == FALSE); |
417 cleanupReqserv(); | 417 cleanupReqserv(); |
418 is_open = TRUE; | 418 is_open = TRUE; |
419 return TRUE; | 419 return TRUE; |
420 } | 420 } |
424 Return TRUE on success, FALSE if an IO error occurs. */ | 424 Return TRUE on success, FALSE if an IO error occurs. */ |
425 void Req_close(void) | 425 void Req_close(void) |
426 { | 426 { |
427 Bool ret = TRUE; | 427 Bool ret = TRUE; |
428 Reqserv* rs; | 428 Reqserv* rs; |
429 Log_dbg("closing request database, writing changes to disk"); | 429 Log_dbg( LOG_DBG_REQUESTS, |
430 "closing request database, writing changes to disk" ); | |
430 ASSERT(is_open == TRUE); | 431 ASSERT(is_open == TRUE); |
431 | 432 |
432 for (rs = reqserv; rs; rs = rs->next) { | 433 for (rs = reqserv; rs; rs = rs->next) { |
433 if (rs->dirty == TRUE) { | 434 if (rs->dirty == TRUE) { |
434 if (!writeRequestfile(rs)) | 435 if (!writeRequestfile(rs)) |