V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
zhicheng
V2EX  ›  程序员

我也分享一个开源项目 libloop , Synchronous I/O Multiplexing and Timer Management, C 语言。

  •  
  •   zhicheng · 2015-09-07 11:50:42 +08:00 · 2682 次点击
    这是一个创建于 3166 天前的主题,其中的信息可能已经有所发展或是发生改变。

    libloop 项目地址 https://github.com/zhicheng/libloop

    项目是从我司的商业项目 OpenNS-DNS (非开源项目, C500K 服务器) 中抽出来的,还没有合并回去,但这只是早晚的事。

    封装了 select,epoll 和 kqueue 。 Linux 是首要支持的平台,*BSD 只做开发级别的支持, Windows 不支持。

    Timer 目前实现用的是 Python heapq 模块(C Port ),性能比较弱,还要优化。

    另外还封装了几个 Unix-Like 下常用的小工具,都是可以单独拿出来用的。

    1. die
    2. socket
    3. pidfile
    4. daemonize

    其它的独立 lib

    1. json.c ,超简单的 JSON parser ,不依赖 allocator 。地址 https://github.com/zhicheng/json
    2. dbm 超小 持久 Hash DB 的实现,从 OpenNS-DNS 项目中抽出来的。地址 https://github.com/zhicheng/db
    3. Bloomfilter 从 OpenNS-DNS 项目中抽出来的。地址 https://github.com/zhicheng/bloomfilter
    4. geohash 的 C 实现,地址 https://github.com/zhicheng/geohash
    5. Python binascii 模块的 C Port ,地址 https://github.com/zhicheng/binascii
    6. Base64 的 C 实现,地址 https://github.com/zhicheng/base64
    7. fequal 用来对比两个浮点数是否相等,你懂的。地址 https://github.com/zhicheng/fequal

    这些都是比较老的项目,因为代码量非常小,所以比较容易使用。有任何问题都可以直接问我。
    说说最近在忙的项目,

    1. WAF,还在考量几种正则引擎的实现。
    2. TLS lib,OpenSSL 简直不能更难用,用现代的方式实现一个 Light 的 TLS 库。

    创建了一个"高性能服务器" QQ 群 487562707 ,欢迎有兴趣的同学进来交流。
    也可以关注我的博客 https://www.textarea.com/zhicheng/ 以后会经常分享一些服务器开发地东西。

    8 条回复    2015-09-07 19:03:59 +08:00
    FeiMa
        1
    FeiMa  
       2015-09-07 12:09:43 +08:00   ❤️ 1
    赞,
    楼主可以加个 IOCP 的吗? win 下的
    zhicheng
        2
    zhicheng  
    OP
       2015-09-07 12:13:22 +08:00
    @FeiMa Windows 不支持 😂
    whatot
        3
    whatot  
       2015-09-07 12:23:16 +08:00   ❤️ 1
    @zhicheng 编译报错, buf.c:295 变量 off 在使用前可能未初始化,前一部分 switch 里面没有包含全部情况。
    CFLAGS += -Wall
    CFLAGS += -Werror
    那应该报错。
    tinkerer
        4
    tinkerer  
       2015-09-07 12:30:36 +08:00   ❤️ 1
    楼主, 你能不能上传个头像...
    zhicheng
        5
    zhicheng  
    OP
       2015-09-07 12:38:20 +08:00
    @whatot 恩,在参数不正确的情况下确实会有 off 未被初始化的问题,我一会儿修一下。
    nareix
        6
    nareix  
       2015-09-07 13:33:02 +08:00   ❤️ 1
    不错。和 libuv 蛮像的。
    catlove
        7
    catlove  
       2015-09-07 14:58:57 +08:00   ❤️ 1
    不错,谢谢分享~
    northisland
        8
    northisland  
       2015-09-07 19:03:59 +08:00
    关注中
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1053 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 20:27 · PVG 04:27 · LAX 13:27 · JFK 16:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.