Permalink
Browse files

- lophttpd: speedup: using reference for accessing idx rather than st…

…ring copy
  • Loading branch information...
stealth committed Feb 28, 2014
1 parent 36c362f commit a89b16a00fd97c69060c10f215fe3afa64c9ba93
Showing with 5 additions and 6 deletions.
  1. +1 −1 flavor-osx.cc
  2. +4 −5 lonely.cc
View
@@ -77,7 +77,7 @@ bool servable_device(const struct stat &st)
bool servable_file(const struct stat &st)
{
// no S_ISLNK() since stat() was used
return S_ISREG(st.st_mode) || S_ISDIR(st.st_mode);
return S_ISBLK(st.st_mode) || S_ISREG(st.st_mode) || S_ISDIR(st.st_mode);
}
View
@@ -642,14 +642,13 @@ int lonely_http::send_genindex()
{
int l = 0, r = 0;
const string &p = peer->path;
string idx = "";
map<string, string>::iterator i = misc::dir2index.find(p);
if (i != misc::dir2index.end())
idx = i->second;
else
if (i == misc::dir2index.end())
return -1;
const string &idx = i->second;
peer->ftype = FILE_GINDEX;
// First called on request?
@@ -1154,7 +1153,7 @@ int lonely_http::GETPOST()
} else if (r == 0 && S_ISDIR(cur_stat.st_mode)) {
peer->offset = 0;
peer->copied = 0;
//peer->left will be set in send_genindex()
//peer->left will be set in send_genindex()
// No Range: requests for directories
if (cur_range_requested)

0 comments on commit a89b16a

Please sign in to comment.