adapted to netlib improvments
This commit is contained in:
parent
e7b557f754
commit
83150abb59
1 changed files with 4 additions and 2 deletions
6
main.cpp
6
main.cpp
|
@ -41,7 +41,8 @@ int main()
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
std::vector<int> readable = server.get_readable();
|
std::vector<int> readable = server.wait_readable();
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||||
for (auto user: readable)
|
for (auto user: readable)
|
||||||
{
|
{
|
||||||
char *data = server.receive_everything(user);
|
char *data = server.receive_everything(user);
|
||||||
|
@ -86,6 +87,8 @@ int main()
|
||||||
int lenght = atoi_newline(dat.data());
|
int lenght = atoi_newline(dat.data());
|
||||||
std::println("{} {}", dat, lenght);
|
std::println("{} {}", dat, lenght);
|
||||||
pos = dat.find("filename=");
|
pos = dat.find("filename=");
|
||||||
|
if (pos == std::string_view::npos)
|
||||||
|
continue;
|
||||||
dat.remove_prefix(pos);
|
dat.remove_prefix(pos);
|
||||||
dat.remove_prefix(strlen("filename="));
|
dat.remove_prefix(strlen("filename="));
|
||||||
std::string_view file_data(data);
|
std::string_view file_data(data);
|
||||||
|
@ -103,6 +106,5 @@ int main()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue