Git Product home page Git Product logo

ahttpd's People

Contributors

lucklove avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ahttpd's Issues

**啊

在issue里为残疾的gcc4.8维护一个workaround是有多逗逼,不会弄一个patch吗

ThreadPool.cc 疑似BUG

ThreadPool.hh里面的worker是std::vector<std::thread> workers

在构造函数中

ThreadPool::ThreadPool(size_t n, std::function<void()> on_enter, std::function<void()> on_exit)
    : workers(n)
{
    for(size_t i = 0; i < n; ++i)
        workers.emplace_back([=]{
            if(on_enter)
                on_enter();
            while(true)
            {

在析构函数中

for(auto& worker : workers)
            try
            {
                worker.join();
            }
            catch(std::system_error&)
            {}

有给这个workers指定大小n,但是在函数体里面却是emplace_back,这样的话:

  • 如果n是0,循环不会进,池子大小是0,无意义
  • 如果n大于0,那么池子的大小将会是2n,在析构函数中前面n个worker.join()可能会segmentation fault

gcc4.8.x workaround

注意:gcc4.8.x特指gcc4.8.2,其它gcc4.8.x未测试

  • 编译时报错:
    /home/lucklove/Test/shttpd/src/server.cc:111:44: error: parameter declared ‘auto’(不一定是111行,因为未来可能会添加或删减代码)
    解决方案:
    编辑server.cc,找到该错误指示的行数
    将wait_to_enqueue(this修改为wait_to_enqueue(this
  • 运行时抛出std::regex_error异常
    解决方案:
  • 安装boost
  • 编辑parser.cc:
  • 将#include 替换为#include <boost/regex.hpp>
  • 将所有std::regex替换为boost::regex
  • 将所有std::smatch替换为boost::smatch
  • 将所有std::regex_search替换为boost::regex_search
  • 编译shttpd
  • 编译可执行文件时加上连接选项-lboost_regex, 对于example,编辑Makefile, 在所有编译命令最后加上-lboost_regex
  • 编译可执行文件

这两个问题目测都是gcc4.8.x的bug, 并没有针对其修改shttpd代码的计划,若因为客观原因必须使用gcc4.8.x者可以参考以上

至于clang3.4.x(特指clang3.4.2)...暂不提供解决方案。原因:
使用-std=c++1y选项编译下面代码:

include

int
main(int argc, char *argv[])
{
}
出现编译错误“/usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/cstdio:120:11: error: no member named 'gets' in the global namespace“

按下Ctrl + c后有时不会退出程序

原因:存在未释放的connection(异步操作正在进行)
修复方案:
1.在server.cc的do_wait_stop函数中添加退出整个程序的调用,比如exit(0)
2.实现一个Connection Manager,并在do_wait_stop中调用之让所有的connection上的异步操作取消

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.