Skip to content

Commit e0dded5

Browse files
author
drscholl
committed
fixes to compile with --enable-resume
1 parent cddd2d3 commit e0dded5

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

TODO

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
* add a timeout to check for blocked server connect() call
22

33
* find bug which results in negative total library size
4+
5+
* lots of things still need to be documented

browse.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ HANDLER (browse_new)
222222
/* same directory as previous result, append */
223223
rsp = append_string (rsp, " \"%s\" %s %d %d %d %d", base,
224224
#if RESUME
225-
d->md5,
225+
d->hash,
226226
#else
227227
"0",
228228
#endif
@@ -248,7 +248,7 @@ HANDLER (browse_new)
248248
rsp = append_string (0, "%s \"%s\" \"%s\" %s %d %d %d %d",
249249
user->nick, dir, base,
250250
#if RESUME
251-
d->md5,
251+
d->hash,
252252
#else
253253
"0",
254254
#endif

resume.c

+8-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ HANDLER (resume)
3232
}
3333

3434
fsize = atoi (av[1]);
35+
if(fsize < 1)
36+
{
37+
send_cmd(con,MSG_SERVER_NOSUCH,"invalid file size");
38+
return;
39+
}
3540

3641
/* search the database for a list of all files which match this hash */
3742
flist = hash_lookup (MD5, av[0]);
@@ -40,13 +45,13 @@ HANDLER (resume)
4045
for (ptr = flist->list; ptr; ptr = ptr->next)
4146
{
4247
d = (DATUM *) ptr->data;
43-
if (d->valid && d->size == fsize)
48+
if (d->size == (size_t)fsize)
4449
{
4550
ASSERT (validate_user (d->user));
4651
send_cmd (con, MSG_SERVER_RESUME_MATCH,
47-
"%s %u %d \"%s%s\" %s %d %hu",
52+
"%s %u %d \"%s\" %s %d %hu",
4853
d->user->nick, d->user->ip, d->user->port,
49-
d->path->path, d->filename, d->hash, d->size,
54+
d->filename, d->hash, d->size,
5055
d->user->speed);
5156
}
5257
}

0 commit comments

Comments
 (0)