├── .gitattributes ├── .gitignore ├── README.en.md ├── README.md ├── debug.sh ├── depends ├── cjson.so ├── lfs.so ├── lsocket.so ├── lsocket │ ├── Makefile │ ├── README.md │ ├── async_resolver.c │ ├── doc │ │ ├── LICENSE │ │ ├── README │ │ └── README_ARESOLVER │ ├── gai_async.c │ ├── gai_async.h │ ├── lsocket-1.3-1.rockspec │ ├── lsocket.c │ ├── lsocket.o │ ├── lsocket.so │ ├── samples │ │ ├── README │ │ ├── httpclient.lua │ │ ├── httpserver.lua │ │ ├── rshttpd.lua │ │ ├── testclt_mcast.lua │ │ ├── testclt_tcp.lua │ │ ├── testclt_udp.lua │ │ ├── testclt_unix.lua │ │ ├── testsrv_mcast.lua │ │ ├── testsrv_tcp.lua │ │ ├── testsrv_udp.lua │ │ └── testsrv_unix.lua │ ├── win_compat.c │ └── win_compat.h ├── lua-cjson │ └── util.lua ├── lua-codec │ ├── LICENSE │ ├── README.md │ ├── src │ │ ├── Makefile │ │ └── codec.c │ └── test │ │ ├── test.lua │ │ ├── test_aes.lua │ │ ├── test_base64.lua │ │ ├── test_hmac_sha1.lua │ │ ├── test_md5.lua │ │ ├── test_rsa_encrypt_decrypt.lua │ │ └── test_rsa_sign_verify.lua ├── lua-lfs │ ├── .gitignore │ ├── .travis.yml │ ├── LICENSE │ ├── Makefile │ ├── Makefile.win │ ├── README.md │ ├── appveyor.yml │ ├── config │ ├── config.win │ ├── rockspecs │ │ ├── luafilesystem-1.3.0-1.rockspec │ │ ├── luafilesystem-1.4.0-1.rockspec │ │ ├── luafilesystem-1.4.0-2.rockspec │ │ ├── luafilesystem-1.4.1-1.rockspec │ │ ├── luafilesystem-1.4.1rc1-1.rockspec │ │ ├── luafilesystem-1.4.2-1.rockspec │ │ ├── luafilesystem-1.5.0-1.rockspec │ │ ├── luafilesystem-1.6.0-1.rockspec │ │ ├── luafilesystem-1.6.1-1.rockspec │ │ ├── luafilesystem-1.6.2-1.rockspec │ │ ├── luafilesystem-1.6.3-1.rockspec │ │ ├── luafilesystem-cvs-1.rockspec │ │ ├── luafilesystem-cvs-2.rockspec │ │ └── luafilesystem-cvs-3.rockspec │ ├── src │ │ ├── .gitignore │ │ ├── lfs.c │ │ └── lfs.h │ └── tests │ │ ├── clientmsg.proto │ │ ├── servermsg.proto │ │ ├── test.lua │ │ └── testdir.lua ├── lua-msgpack │ └── MessagePack.lua ├── lua-openssl │ ├── .gitignore │ ├── .gitmodules │ ├── .travis.yml │ ├── .travis │ │ ├── platform.sh │ │ ├── setenv_lua.sh │ │ ├── setup_lua.sh │ │ └── setup_uv.sh │ ├── LICENSE │ ├── Makefile │ ├── Makefile.win │ ├── README.md │ ├── STATE.md │ ├── appveyor.yml │ ├── config.win │ ├── deps │ │ ├── auxiliar │ │ │ ├── auxiliar.c │ │ │ └── auxiliar.h │ │ └── lua-compat │ │ │ └── c-api │ │ │ ├── compat-5.3.c │ │ │ └── compat-5.3.h │ ├── ldoc │ │ ├── asn1.lua │ │ ├── bio.lua │ │ ├── cipher.lua │ │ ├── cms.lua │ │ ├── config.ld │ │ ├── digest.lua │ │ ├── hmac.lua │ │ ├── openssl.lua │ │ ├── pkcs12.lua │ │ ├── pkcs7.lua │ │ ├── pkey.lua │ │ ├── sk.lua │ │ ├── ssl.lua │ │ ├── timestamp.lua │ │ ├── x509.lua │ │ ├── x509_attr.lua │ │ ├── x509_crl.lua │ │ ├── x509_extension.lua │ │ ├── x509_name.lua │ │ ├── x509_req.lua │ │ └── x509_store.lua │ ├── lib │ │ ├── crypto.lua │ │ ├── luv │ │ │ └── ssl.lua │ │ └── ssl.lua │ ├── rockspecs │ │ ├── openssl-scm-0.rockspec │ │ └── openssl-scm-1.rockspec │ ├── src │ │ ├── asn1.c │ │ ├── auxiliar.c │ │ ├── auxiliar.h │ │ ├── bio.c │ │ ├── callback.c │ │ ├── cipher.c │ │ ├── cms.c │ │ ├── compat.c │ │ ├── crl.c │ │ ├── csr.c │ │ ├── dh.c │ │ ├── digest.c │ │ ├── dsa.c │ │ ├── ec.c │ │ ├── engine.c │ │ ├── hmac.c │ │ ├── lbn.c │ │ ├── lhash.c │ │ ├── misc.c │ │ ├── ocsp.c │ │ ├── oids.txt │ │ ├── openssl.c │ │ ├── openssl.h │ │ ├── ots.c │ │ ├── pkcs12.c │ │ ├── pkcs7.c │ │ ├── pkey.c │ │ ├── private.h │ │ ├── rsa.c │ │ ├── sk.h │ │ ├── ssl.c │ │ ├── ssl_options.h │ │ ├── th-lock.c │ │ ├── util.c │ │ ├── x509.c │ │ ├── xalgor.c │ │ ├── xattrs.c │ │ ├── xexts.c │ │ ├── xname.c │ │ └── xstore.c │ └── test │ │ ├── 0.engine.lua │ │ ├── 0.misc.lua │ │ ├── 0.tcp.lua │ │ ├── 0.tcp_c.lua │ │ ├── 0.tcp_s.lua │ │ ├── 1.asn1.lua │ │ ├── 1.x509_attr.lua │ │ ├── 1.x509_extension.lua │ │ ├── 1.x509_name.lua │ │ ├── 2.asn1.lua │ │ ├── 2.digest.lua │ │ ├── 2.hmac.lua │ │ ├── 3.cipher.lua │ │ ├── 4.pkey.lua │ │ ├── 5.ts.lua │ │ ├── 5.x509.lua │ │ ├── 5.x509_crl.lua │ │ ├── 5.x509_req.lua │ │ ├── 6.pkcs7.lua │ │ ├── 7.pkcs12.lua │ │ ├── 8.bio_c.lua │ │ ├── 8.bio_s.lua │ │ ├── 8.ssl.lua │ │ ├── 8.ssl_c.lua │ │ ├── 8.ssl_options.lua │ │ ├── 8.ssl_s.lua │ │ ├── bn.lua │ │ ├── ec.lua │ │ ├── issue#75.lua │ │ ├── luacrypto │ │ ├── ca │ │ │ ├── README │ │ │ ├── ca.crt │ │ │ ├── ca.key │ │ │ ├── server.crt │ │ │ ├── server.csr │ │ │ ├── server.key │ │ │ └── server.key.insecure │ │ ├── encrypt.lua │ │ ├── message │ │ ├── open_seal.lua │ │ ├── pkeytest.lua │ │ ├── rand.lua │ │ ├── run-test.lua │ │ ├── test.lua │ │ └── x509_ca.lua │ │ ├── luasec │ │ ├── README │ │ ├── certs │ │ │ ├── clientA.cnf │ │ │ ├── clientA.pem │ │ │ ├── clientAcert.pem │ │ │ ├── clientAkey.pem │ │ │ ├── clientAreq.pem │ │ │ ├── clientB.cnf │ │ │ ├── clientB.pem │ │ │ ├── clientBcert.pem │ │ │ ├── clientBkey.pem │ │ │ ├── clientBreq.pem │ │ │ ├── rootA.cnf │ │ │ ├── rootA.pem │ │ │ ├── rootA.srl │ │ │ ├── rootAkey.pem │ │ │ ├── rootAreq.pem │ │ │ ├── rootB.cnf │ │ │ ├── rootB.pem │ │ │ ├── rootB.srl │ │ │ ├── rootBkey.pem │ │ │ ├── rootBreq.pem │ │ │ ├── serverA.cnf │ │ │ ├── serverA.pem │ │ │ ├── serverAcert.pem │ │ │ ├── serverAkey.pem │ │ │ ├── serverAreq.pem │ │ │ ├── serverB.cnf │ │ │ ├── serverB.pem │ │ │ ├── serverBcert.pem │ │ │ ├── serverBkey.pem │ │ │ └── serverBreq.pem │ │ ├── chain │ │ │ ├── client.lua │ │ │ ├── server.lua │ │ │ └── util.lua │ │ ├── dhparam │ │ │ ├── client.lua │ │ │ ├── dh-1024.pem │ │ │ ├── dh-512.pem │ │ │ └── server.lua │ │ ├── digest │ │ │ ├── client.lua │ │ │ └── server.lua │ │ ├── ecdh │ │ │ ├── client.lua │ │ │ └── server.lua │ │ ├── info │ │ │ ├── client.lua │ │ │ └── server.lua │ │ ├── key │ │ │ ├── key.pem │ │ │ └── loadkey.lua │ │ ├── loop-gc │ │ │ ├── client.lua │ │ │ └── server.lua │ │ ├── loop │ │ │ ├── client.lua │ │ │ └── server.lua │ │ ├── oneshot │ │ │ ├── client.lua │ │ │ └── server.lua │ │ ├── sni │ │ │ ├── client.lua │ │ │ └── server.lua │ │ ├── verification │ │ │ ├── fail-string │ │ │ │ ├── client.lua │ │ │ │ └── server.lua │ │ │ ├── fail-table │ │ │ │ ├── client.lua │ │ │ │ └── server.lua │ │ │ └── success │ │ │ │ ├── client.lua │ │ │ │ └── server.lua │ │ ├── verify │ │ │ ├── client.lua │ │ │ └── server.lua │ │ ├── want │ │ │ ├── client.lua │ │ │ └── server.lua │ │ ├── wantread │ │ │ ├── client.lua │ │ │ └── server.lua │ │ └── wantwrite │ │ │ ├── client.lua │ │ │ └── server.lua │ │ ├── luaunit.lua │ │ ├── luv_ssl │ │ ├── ssl_c.lua │ │ └── ssl_s.lua │ │ ├── memleaks.lua │ │ ├── root_ca.lua │ │ ├── rsa.lua │ │ ├── sslctx.lua │ │ └── test.lua ├── lua-pbc │ ├── parser.lua │ ├── pbc.lua │ ├── protobuf.lua │ └── src │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── Android.mk │ │ ├── Makefile │ │ ├── README.md │ │ ├── binding │ │ ├── lua │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── build_ios.sh │ │ │ ├── parser.lua │ │ │ ├── pbc-lua.c │ │ │ ├── protobuf.lua │ │ │ ├── test.lua │ │ │ ├── test2.lua │ │ │ └── testparser.lua │ │ └── lua53 │ │ │ ├── Makefile │ │ │ ├── build_ios.sh │ │ │ ├── pbc-lua53.c │ │ │ ├── protobuf.lua │ │ │ └── test.lua │ │ ├── build_ios.sh │ │ ├── license.txt │ │ ├── pbc.h │ │ ├── pbc.sln │ │ ├── pbc.vcxproj │ │ ├── pbc.vcxproj.filters │ │ ├── pbc.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ ├── src │ │ ├── alloc.c │ │ ├── alloc.h │ │ ├── array.c │ │ ├── array.h │ │ ├── bootstrap.c │ │ ├── bootstrap.h │ │ ├── context.c │ │ ├── context.h │ │ ├── decode.c │ │ ├── descriptor.pbc.h │ │ ├── map.c │ │ ├── map.h │ │ ├── pattern.c │ │ ├── pattern.h │ │ ├── proto.c │ │ ├── proto.h │ │ ├── register.c │ │ ├── rmessage.c │ │ ├── stringpool.c │ │ ├── stringpool.h │ │ ├── varint.c │ │ ├── varint.h │ │ └── wmessage.c │ │ ├── test │ │ ├── addressbook.c │ │ ├── addressbook.proto │ │ ├── array.c │ │ ├── decode.c │ │ ├── descriptor.proto │ │ ├── float.c │ │ ├── float.proto │ │ ├── map.c │ │ ├── pattern.c │ │ ├── pbc.c │ │ ├── readfile.h │ │ ├── test.c │ │ ├── test.proto │ │ └── varint.c │ │ └── tool │ │ └── dump.c ├── lua-snapshot │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── dump.lua │ └── snapshot.c ├── lua-xml │ ├── xmlSimple.lua │ └── xmlTest.lua ├── protobuf.so └── skynet │ ├── .gitmodules │ ├── 3rd │ ├── crab │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── README.md │ │ ├── crab.c │ │ ├── lua-crab.c │ │ ├── lua-utf8.c │ │ ├── test.lua │ │ ├── texts.txt │ │ └── words.txt │ ├── jemalloc │ │ ├── .appveyor.yml │ │ ├── .autom4te.cfg │ │ ├── .gitattributes │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── COPYING │ │ ├── ChangeLog │ │ ├── INSTALL.md │ │ ├── Makefile.in │ │ ├── README │ │ ├── autogen.sh │ │ ├── bin │ │ │ ├── jemalloc-config.in │ │ │ ├── jemalloc.sh.in │ │ │ └── jeprof.in │ │ ├── build-aux │ │ │ ├── config.guess │ │ │ ├── config.sub │ │ │ └── install-sh │ │ ├── config.stamp.in │ │ ├── configure.ac │ │ ├── doc │ │ │ ├── html.xsl.in │ │ │ ├── jemalloc.xml.in │ │ │ ├── manpages.xsl.in │ │ │ └── stylesheet.xsl │ │ ├── include │ │ │ ├── jemalloc │ │ │ │ ├── internal │ │ │ │ │ ├── arena_externs.h │ │ │ │ │ ├── arena_inlines_a.h │ │ │ │ │ ├── arena_inlines_b.h │ │ │ │ │ ├── arena_structs_a.h │ │ │ │ │ ├── arena_structs_b.h │ │ │ │ │ ├── arena_types.h │ │ │ │ │ ├── assert.h │ │ │ │ │ ├── atomic.h │ │ │ │ │ ├── atomic_c11.h │ │ │ │ │ ├── atomic_gcc_atomic.h │ │ │ │ │ ├── atomic_gcc_sync.h │ │ │ │ │ ├── atomic_msvc.h │ │ │ │ │ ├── background_thread_externs.h │ │ │ │ │ ├── background_thread_inlines.h │ │ │ │ │ ├── background_thread_structs.h │ │ │ │ │ ├── base_externs.h │ │ │ │ │ ├── base_inlines.h │ │ │ │ │ ├── base_structs.h │ │ │ │ │ ├── base_types.h │ │ │ │ │ ├── bit_util.h │ │ │ │ │ ├── bitmap.h │ │ │ │ │ ├── cache_bin.h │ │ │ │ │ ├── ckh.h │ │ │ │ │ ├── ctl.h │ │ │ │ │ ├── extent_dss.h │ │ │ │ │ ├── extent_externs.h │ │ │ │ │ ├── extent_inlines.h │ │ │ │ │ ├── extent_mmap.h │ │ │ │ │ ├── extent_structs.h │ │ │ │ │ ├── extent_types.h │ │ │ │ │ ├── hash.h │ │ │ │ │ ├── hooks.h │ │ │ │ │ ├── jemalloc_internal_decls.h │ │ │ │ │ ├── jemalloc_internal_defs.h.in │ │ │ │ │ ├── jemalloc_internal_externs.h │ │ │ │ │ ├── jemalloc_internal_includes.h │ │ │ │ │ ├── jemalloc_internal_inlines_a.h │ │ │ │ │ ├── jemalloc_internal_inlines_b.h │ │ │ │ │ ├── jemalloc_internal_inlines_c.h │ │ │ │ │ ├── jemalloc_internal_macros.h │ │ │ │ │ ├── jemalloc_internal_types.h │ │ │ │ │ ├── jemalloc_preamble.h.in │ │ │ │ │ ├── large_externs.h │ │ │ │ │ ├── log.h │ │ │ │ │ ├── malloc_io.h │ │ │ │ │ ├── mutex.h │ │ │ │ │ ├── mutex_pool.h │ │ │ │ │ ├── mutex_prof.h │ │ │ │ │ ├── nstime.h │ │ │ │ │ ├── pages.h │ │ │ │ │ ├── ph.h │ │ │ │ │ ├── private_namespace.sh │ │ │ │ │ ├── private_symbols.sh │ │ │ │ │ ├── prng.h │ │ │ │ │ ├── prof_externs.h │ │ │ │ │ ├── prof_inlines_a.h │ │ │ │ │ ├── prof_inlines_b.h │ │ │ │ │ ├── prof_structs.h │ │ │ │ │ ├── prof_types.h │ │ │ │ │ ├── public_namespace.sh │ │ │ │ │ ├── public_unnamespace.sh │ │ │ │ │ ├── ql.h │ │ │ │ │ ├── qr.h │ │ │ │ │ ├── rb.h │ │ │ │ │ ├── rtree.h │ │ │ │ │ ├── rtree_tsd.h │ │ │ │ │ ├── size_classes.sh │ │ │ │ │ ├── smoothstep.h │ │ │ │ │ ├── smoothstep.sh │ │ │ │ │ ├── spin.h │ │ │ │ │ ├── stats.h │ │ │ │ │ ├── sz.h │ │ │ │ │ ├── tcache_externs.h │ │ │ │ │ ├── tcache_inlines.h │ │ │ │ │ ├── tcache_structs.h │ │ │ │ │ ├── tcache_types.h │ │ │ │ │ ├── ticker.h │ │ │ │ │ ├── tsd.h │ │ │ │ │ ├── tsd_generic.h │ │ │ │ │ ├── tsd_malloc_thread_cleanup.h │ │ │ │ │ ├── tsd_tls.h │ │ │ │ │ ├── tsd_types.h │ │ │ │ │ ├── tsd_win.h │ │ │ │ │ ├── util.h │ │ │ │ │ └── witness.h │ │ │ │ ├── jemalloc.sh │ │ │ │ ├── jemalloc_defs.h.in │ │ │ │ ├── jemalloc_macros.h.in │ │ │ │ ├── jemalloc_mangle.sh │ │ │ │ ├── jemalloc_protos.h.in │ │ │ │ ├── jemalloc_rename.sh │ │ │ │ └── jemalloc_typedefs.h.in │ │ │ └── msvc_compat │ │ │ │ ├── C99 │ │ │ │ ├── stdbool.h │ │ │ │ └── stdint.h │ │ │ │ ├── strings.h │ │ │ │ └── windows_extra.h │ │ ├── jemalloc.pc.in │ │ ├── m4 │ │ │ └── ax_cxx_compile_stdcxx.m4 │ │ ├── msvc │ │ │ ├── ReadMe.txt │ │ │ ├── jemalloc_vc2015.sln │ │ │ └── projects │ │ │ │ └── vc2015 │ │ │ │ ├── jemalloc │ │ │ │ ├── jemalloc.vcxproj │ │ │ │ └── jemalloc.vcxproj.filters │ │ │ │ └── test_threads │ │ │ │ ├── test_threads.cpp │ │ │ │ ├── test_threads.h │ │ │ │ ├── test_threads.vcxproj │ │ │ │ ├── test_threads.vcxproj.filters │ │ │ │ └── test_threads_main.cpp │ │ ├── run_tests.sh │ │ ├── scripts │ │ │ ├── gen_run_tests.py │ │ │ └── gen_travis.py │ │ ├── src │ │ │ ├── arena.c │ │ │ ├── background_thread.c │ │ │ ├── base.c │ │ │ ├── bitmap.c │ │ │ ├── ckh.c │ │ │ ├── ctl.c │ │ │ ├── extent.c │ │ │ ├── extent_dss.c │ │ │ ├── extent_mmap.c │ │ │ ├── hash.c │ │ │ ├── hooks.c │ │ │ ├── jemalloc.c │ │ │ ├── jemalloc_cpp.cpp │ │ │ ├── large.c │ │ │ ├── log.c │ │ │ ├── malloc_io.c │ │ │ ├── mutex.c │ │ │ ├── mutex_pool.c │ │ │ ├── nstime.c │ │ │ ├── pages.c │ │ │ ├── prng.c │ │ │ ├── prof.c │ │ │ ├── rtree.c │ │ │ ├── stats.c │ │ │ ├── sz.c │ │ │ ├── tcache.c │ │ │ ├── ticker.c │ │ │ ├── tsd.c │ │ │ ├── witness.c │ │ │ └── zone.c │ │ └── test │ │ │ ├── include │ │ │ └── test │ │ │ │ ├── SFMT-alti.h │ │ │ │ ├── SFMT-params.h │ │ │ │ ├── SFMT-params11213.h │ │ │ │ ├── SFMT-params1279.h │ │ │ │ ├── SFMT-params132049.h │ │ │ │ ├── SFMT-params19937.h │ │ │ │ ├── SFMT-params216091.h │ │ │ │ ├── SFMT-params2281.h │ │ │ │ ├── SFMT-params4253.h │ │ │ │ ├── SFMT-params44497.h │ │ │ │ ├── SFMT-params607.h │ │ │ │ ├── SFMT-params86243.h │ │ │ │ ├── SFMT-sse2.h │ │ │ │ ├── SFMT.h │ │ │ │ ├── btalloc.h │ │ │ │ ├── extent_hooks.h │ │ │ │ ├── jemalloc_test.h.in │ │ │ │ ├── jemalloc_test_defs.h.in │ │ │ │ ├── math.h │ │ │ │ ├── mq.h │ │ │ │ ├── mtx.h │ │ │ │ ├── test.h │ │ │ │ ├── thd.h │ │ │ │ └── timer.h │ │ │ ├── integration │ │ │ ├── MALLOCX_ARENA.c │ │ │ ├── aligned_alloc.c │ │ │ ├── allocated.c │ │ │ ├── extent.c │ │ │ ├── extent.sh │ │ │ ├── mallocx.c │ │ │ ├── mallocx.sh │ │ │ ├── overflow.c │ │ │ ├── posix_memalign.c │ │ │ ├── rallocx.c │ │ │ ├── sdallocx.c │ │ │ ├── thread_arena.c │ │ │ ├── thread_tcache_enabled.c │ │ │ ├── xallocx.c │ │ │ └── xallocx.sh │ │ │ ├── src │ │ │ ├── SFMT.c │ │ │ ├── btalloc.c │ │ │ ├── btalloc_0.c │ │ │ ├── btalloc_1.c │ │ │ ├── math.c │ │ │ ├── mq.c │ │ │ ├── mtx.c │ │ │ ├── test.c │ │ │ ├── thd.c │ │ │ └── timer.c │ │ │ ├── stress │ │ │ └── microbench.c │ │ │ ├── test.sh.in │ │ │ └── unit │ │ │ ├── SFMT.c │ │ │ ├── a0.c │ │ │ ├── arena_reset.c │ │ │ ├── arena_reset_prof.c │ │ │ ├── arena_reset_prof.sh │ │ │ ├── atomic.c │ │ │ ├── background_thread.c │ │ │ ├── base.c │ │ │ ├── bit_util.c │ │ │ ├── bitmap.c │ │ │ ├── ckh.c │ │ │ ├── decay.c │ │ │ ├── decay.sh │ │ │ ├── extent_quantize.c │ │ │ ├── fork.c │ │ │ ├── hash.c │ │ │ ├── hooks.c │ │ │ ├── junk.c │ │ │ ├── junk.sh │ │ │ ├── junk_alloc.c │ │ │ ├── junk_alloc.sh │ │ │ ├── junk_free.c │ │ │ ├── junk_free.sh │ │ │ ├── log.c │ │ │ ├── mallctl.c │ │ │ ├── malloc_io.c │ │ │ ├── math.c │ │ │ ├── mq.c │ │ │ ├── mtx.c │ │ │ ├── nstime.c │ │ │ ├── pack.c │ │ │ ├── pack.sh │ │ │ ├── pages.c │ │ │ ├── ph.c │ │ │ ├── prng.c │ │ │ ├── prof_accum.c │ │ │ ├── prof_accum.sh │ │ │ ├── prof_active.c │ │ │ ├── prof_active.sh │ │ │ ├── prof_gdump.c │ │ │ ├── prof_gdump.sh │ │ │ ├── prof_idump.c │ │ │ ├── prof_idump.sh │ │ │ ├── prof_reset.c │ │ │ ├── prof_reset.sh │ │ │ ├── prof_tctx.c │ │ │ ├── prof_tctx.sh │ │ │ ├── prof_thread_name.c │ │ │ ├── prof_thread_name.sh │ │ │ ├── ql.c │ │ │ ├── qr.c │ │ │ ├── rb.c │ │ │ ├── retained.c │ │ │ ├── rtree.c │ │ │ ├── size_classes.c │ │ │ ├── slab.c │ │ │ ├── smoothstep.c │ │ │ ├── spin.c │ │ │ ├── stats.c │ │ │ ├── stats_print.c │ │ │ ├── ticker.c │ │ │ ├── tsd.c │ │ │ ├── witness.c │ │ │ ├── zero.c │ │ │ └── zero.sh │ ├── lpeg │ │ ├── HISTORY │ │ ├── lpcap.c │ │ ├── lpcap.h │ │ ├── lpcode.c │ │ ├── lpcode.h │ │ ├── lpeg-128.gif │ │ ├── lpeg.html │ │ ├── lpprint.c │ │ ├── lpprint.h │ │ ├── lptree.c │ │ ├── lptree.h │ │ ├── lptypes.h │ │ ├── lpvm.c │ │ ├── lpvm.h │ │ ├── makefile │ │ ├── re.html │ │ ├── re.lua │ │ └── test.lua │ ├── lua-md5 │ │ ├── README │ │ ├── compat-5.2.c │ │ ├── compat-5.2.h │ │ ├── md5.c │ │ ├── md5.h │ │ └── md5lib.c │ └── lua │ │ ├── Makefile │ │ ├── README │ │ ├── lapi.c │ │ ├── lapi.h │ │ ├── lapi.o │ │ ├── lauxlib.c │ │ ├── lauxlib.h │ │ ├── lauxlib.o │ │ ├── lbaselib.c │ │ ├── lbaselib.o │ │ ├── lbitlib.c │ │ ├── lbitlib.o │ │ ├── lcode.c │ │ ├── lcode.h │ │ ├── lcode.o │ │ ├── lcorolib.c │ │ ├── lcorolib.o │ │ ├── lctype.c │ │ ├── lctype.h │ │ ├── lctype.o │ │ ├── ldblib.c │ │ ├── ldblib.o │ │ ├── ldebug.c │ │ ├── ldebug.h │ │ ├── ldebug.o │ │ ├── ldo.c │ │ ├── ldo.h │ │ ├── ldo.o │ │ ├── ldump.c │ │ ├── ldump.o │ │ ├── lfunc.c │ │ ├── lfunc.h │ │ ├── lfunc.o │ │ ├── lgc.c │ │ ├── lgc.h │ │ ├── lgc.o │ │ ├── liblua.a │ │ ├── linit.c │ │ ├── linit.o │ │ ├── liolib.c │ │ ├── liolib.o │ │ ├── llex.c │ │ ├── llex.h │ │ ├── llex.o │ │ ├── llimits.h │ │ ├── lmathlib.c │ │ ├── lmathlib.o │ │ ├── lmem.c │ │ ├── lmem.h │ │ ├── lmem.o │ │ ├── loadlib.c │ │ ├── loadlib.o │ │ ├── lobject.c │ │ ├── lobject.h │ │ ├── lobject.o │ │ ├── lopcodes.c │ │ ├── lopcodes.h │ │ ├── lopcodes.o │ │ ├── loslib.c │ │ ├── loslib.o │ │ ├── lparser.c │ │ ├── lparser.h │ │ ├── lparser.o │ │ ├── lprefix.h │ │ ├── lstate.c │ │ ├── lstate.h │ │ ├── lstate.o │ │ ├── lstring.c │ │ ├── lstring.h │ │ ├── lstring.o │ │ ├── lstrlib.c │ │ ├── lstrlib.o │ │ ├── ltable.c │ │ ├── ltable.h │ │ ├── ltable.o │ │ ├── ltablib.c │ │ ├── ltablib.o │ │ ├── ltm.c │ │ ├── ltm.h │ │ ├── ltm.o │ │ ├── lua │ │ ├── lua.c │ │ ├── lua.h │ │ ├── lua.hpp │ │ ├── lua.o │ │ ├── luac │ │ ├── luac.c │ │ ├── luac.o │ │ ├── luaconf.h │ │ ├── lualib.h │ │ ├── lundump.c │ │ ├── lundump.h │ │ ├── lundump.o │ │ ├── lutf8lib.c │ │ ├── lutf8lib.o │ │ ├── lvm.c │ │ ├── lvm.h │ │ ├── lvm.o │ │ ├── lzio.c │ │ ├── lzio.h │ │ └── lzio.o │ ├── HISTORY.md │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── cservice │ ├── gate.so │ ├── harbor.so │ ├── logger.so │ └── snlua.so │ ├── examples │ ├── abort.lua │ ├── agent.lua │ ├── checkdeadloop.lua │ ├── client.lua │ ├── cluster1.lua │ ├── cluster2.lua │ ├── clustername.lua │ ├── config │ ├── config.c1 │ ├── config.c2 │ ├── config.login │ ├── config.mc │ ├── config.mysql │ ├── config.userlog │ ├── config_log │ ├── globallog.lua │ ├── injectlaunch.lua │ ├── login │ │ ├── client.lua │ │ ├── gated.lua │ │ ├── logind.lua │ │ ├── main.lua │ │ └── msgagent.lua │ ├── main.lua │ ├── main_log.lua │ ├── main_mysql.lua │ ├── preload.lua │ ├── proto.lua │ ├── protoloader.lua │ ├── share.lua │ ├── simpledb.lua │ ├── simplemonitor.lua │ ├── simpleweb.lua │ ├── userlog.lua │ └── watchdog.lua │ ├── luaclib │ ├── bson.so │ ├── clientsocket.so │ ├── clientwebsocket.so │ ├── cluster.so │ ├── crab.so │ ├── crypt.so │ ├── debugchannel.so │ ├── lpeg.so │ ├── ltime.so │ ├── md5.so │ ├── memory.so │ ├── mongo.so │ ├── multicast.so │ ├── mysqlaux.so │ ├── netpack.so │ ├── profile.so │ ├── sharedata.so │ ├── skynet.so │ ├── socketdriver.so │ ├── sproto.so │ ├── stm.so │ ├── utf8.so │ └── websocketnetpack.so │ ├── lualib-src │ ├── lsha1.c │ ├── lua-bson.c │ ├── lua-clientsocket.c │ ├── lua-clientwebsocket.c │ ├── lua-cluster.c │ ├── lua-crypt.c │ ├── lua-debugchannel.c │ ├── lua-ltime.c │ ├── lua-memory.c │ ├── lua-mongo.c │ ├── lua-multicast.c │ ├── lua-mysqlaux.c │ ├── lua-netpack.c │ ├── lua-profile.c │ ├── lua-seri.c │ ├── lua-seri.h │ ├── lua-sharedata.c │ ├── lua-skynet.c │ ├── lua-socket.c │ ├── lua-stm.c │ ├── lua-websocketnetpack.c │ └── sproto │ │ ├── README │ │ ├── README.md │ │ ├── lsproto.c │ │ ├── msvcint.h │ │ ├── sproto.c │ │ └── sproto.h │ ├── lualib │ ├── cluster.lua │ ├── datacenter.lua │ ├── dns.lua │ ├── http │ │ ├── httpc.lua │ │ ├── httpd.lua │ │ ├── internal.lua │ │ ├── sockethelper.lua │ │ └── url.lua │ ├── loader.lua │ ├── md5.lua │ ├── mongo.lua │ ├── mqueue.lua │ ├── multicast.lua │ ├── mysql.lua │ ├── redis.lua │ ├── reload.lua │ ├── sharedata.lua │ ├── sharedata │ │ └── corelib.lua │ ├── sharemap.lua │ ├── skynet.lua │ ├── skynet │ │ ├── coroutine.lua │ │ ├── debug.lua │ │ ├── harbor.lua │ │ ├── inject.lua │ │ ├── injectcode.lua │ │ ├── manager.lua │ │ ├── queue.lua │ │ └── remotedebug.lua │ ├── snax.lua │ ├── snax │ │ ├── gateserver.lua │ │ ├── hotfix.lua │ │ ├── interface.lua │ │ ├── loginserver.lua │ │ ├── msgserver.lua │ │ └── wsgateserver.lua │ ├── socket.lua │ ├── socketchannel.lua │ ├── sproto.lua │ ├── sprotoloader.lua │ ├── sprotoparser.lua │ └── websocket.lua │ ├── platform.mk │ ├── service-src │ ├── databuffer.h │ ├── hashid.h │ ├── service_gate.c │ ├── service_harbor.c │ ├── service_logger.c │ └── service_snlua.c │ ├── service │ ├── bootstrap.lua │ ├── cdummy.lua │ ├── clusterd.lua │ ├── clusterproxy.lua │ ├── cmaster.lua │ ├── cmemory.lua │ ├── console.lua │ ├── cslave.lua │ ├── datacenterd.lua │ ├── dbg.lua │ ├── debug_agent.lua │ ├── debug_console.lua │ ├── gate.lua │ ├── launcher.lua │ ├── multicastd.lua │ ├── reloadd.lua │ ├── service_mgr.lua │ ├── sharedatad.lua │ ├── snaxd.lua │ └── wsgate.lua │ ├── skynet │ ├── skynet-src │ ├── atomic.h │ ├── luashrtbl.h │ ├── malloc_hook.c │ ├── malloc_hook.h │ ├── rwlock.h │ ├── skynet.h │ ├── skynet_daemon.c │ ├── skynet_daemon.h │ ├── skynet_env.c │ ├── skynet_env.h │ ├── skynet_error.c │ ├── skynet_handle.c │ ├── skynet_handle.h │ ├── skynet_harbor.c │ ├── skynet_harbor.h │ ├── skynet_imp.h │ ├── skynet_log.c │ ├── skynet_log.h │ ├── skynet_main.c │ ├── skynet_malloc.h │ ├── skynet_module.c │ ├── skynet_module.h │ ├── skynet_monitor.c │ ├── skynet_monitor.h │ ├── skynet_mq.c │ ├── skynet_mq.h │ ├── skynet_server.c │ ├── skynet_server.h │ ├── skynet_socket.c │ ├── skynet_socket.h │ ├── skynet_start.c │ ├── skynet_timer.c │ ├── skynet_timer.h │ ├── socket_epoll.h │ ├── socket_kqueue.h │ ├── socket_poll.h │ ├── socket_server.c │ ├── socket_server.h │ └── spinlock.h │ └── test │ ├── pingserver.lua │ ├── sharemap.sp │ ├── testbson.lua │ ├── testcoroutine.lua │ ├── testdatacenter.lua │ ├── testdeadcall.lua │ ├── testdeadloop.lua │ ├── testdns.lua │ ├── testecho.lua │ ├── testendless.lua │ ├── testharborlink.lua │ ├── testhttp.lua │ ├── testmemlimit.lua │ ├── testmongodb.lua │ ├── testmulticast.lua │ ├── testmulticast2.lua │ ├── testmysql.lua │ ├── testoverload.lua │ ├── testping.lua │ ├── testpipeline.lua │ ├── testqueue.lua │ ├── testredis.lua │ ├── testredis2.lua │ ├── testresponse.lua │ ├── testsha.lua │ ├── testsm.lua │ ├── testsocket.lua │ ├── teststm.lua │ ├── testterm.lua │ ├── testtimer.lua │ ├── testudp.lua │ ├── testwebsocket.lua │ └── time.lua ├── hotfix.py ├── image1.png ├── killall.sh └── server ├── common ├── Hotfix.lua ├── Logger.lua ├── MessageDispatch.lua ├── ProtoLoader.lua ├── algorithm │ ├── QLinkeList.lua │ ├── QQueue.lua │ ├── QStack.lua │ └── QTree.lua ├── base │ ├── fsm.lua │ ├── help.lua │ ├── logger.lua │ ├── luaext.lua │ ├── preload.lua │ ├── timer.lua │ └── util.lua ├── conf │ ├── confcenter.lua │ ├── configquery.lua │ └── configtool.lua ├── hotfix │ ├── hotfix.lua │ ├── hotfix_helper.lua │ ├── internal │ │ ├── functions_replacer.lua │ │ └── module_updater.lua │ └── test │ │ ├── hotfix_module_names.lua │ │ ├── test02.lua │ │ └── test_service.lua └── lang │ ├── Language.lua │ └── ch.lua ├── config └── setting │ └── server_setting.lua ├── loginserver ├── config ├── main.lua └── manager_service │ ├── MessageHandler.lua │ └── manager_service.lua └── run.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | *.lua linguist-language=lua 2 | *.h linguist-language=lua 3 | *.c linguist-language=lua -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #Custom 2 | *.DS_Store 3 | logs 4 | *.pyc 5 | *.out 6 | ~$* 7 | #service_setting 8 | configTool/tools/sconfig 9 | nohup.out -------------------------------------------------------------------------------- /README.en.md: -------------------------------------------------------------------------------- 1 | # skynet_hotfix 2 | 3 | #### Description 4 | 框架 5 | 6 | #### Software Architecture 7 | Software architecture description 8 | 9 | #### Installation 10 | 11 | 1. xxxx 12 | 2. xxxx 13 | 3. xxxx 14 | 15 | #### Instructions 16 | 17 | 1. xxxx 18 | 2. xxxx 19 | 3. xxxx 20 | 21 | #### Contribution 22 | 23 | 1. Fork the repository 24 | 2. Create Feat_xxx branch 25 | 3. Commit your code 26 | 4. Create Pull Request 27 | 28 | 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # skynet_hotfix 2 | 3 | #### 介绍 4 | 1. skynet 热更新功能演示, 热更分为已启动的服务的代码逻辑热更, 文件修改后新启动服务的同步更新 5 | 2. debug.sh 启动后, 会开定时器不断启动新服务, 6 | 3. 在已启动服务manager_service里有定时器不断调用test函数 7 | 4. 修改MessageHandler.lua 里的 test函数改变输出内容 8 | 5. python hotfix.py 会看到输出的改变 9 | 10 | 原理是 clearcache 清除代码缓存后 11 | 清除lua模块缓存 package.loaded[file_path] = nil 12 | 对已创建的对象方法进行更新 13 | 14 | ![image1](/image1.png) 15 | 16 | #### 软件架构 17 | 软件架构说明 18 | >depends --skynet引擎已编译好
19 | >server --游戏框架
20 | >>common --公用的代码,配置
21 | >>config --配置文件
22 | >>proto --pb文件
23 | 24 | 每个节点里都有一个manager_service 负责节点消息派发与 service管理 25 | 26 | #### 运行步骤 27 | 28 | 29 | 2. debug.sh 30 | 3. killall.sh 结束所有skynet进程 31 | 32 | #### 规范和约定说明 33 | 34 | 1. server结尾的文件夹代表一个节点(进程) 35 | 2. _service结尾的文件夹代表一个服务与其业务集,一个服务相关的逻辑代码放在一个文件夹里 36 | 3. _service.lua 结尾的lua文件代码一个服务起动入口 37 | 4. 服务里的逻辑代码以类的形式存在,类文件名以大写字母开头如Command.lua 38 | 5. 类函数,使用小驼峰名字 39 | 6. 变量使用小字母加_ 的形式命名, 如 message_name 尽量不要让名字太长. 40 | 41 | 42 | #### 目标 43 | 1. 探讨skynet的一种面向对象的开发方式 44 | 2. 感兴趣的朋友加qq群 373245593 一起学习 45 | 3. 觉得好可以给个star 鼓励下 46 | 4. 服务器框架的各个模块的再学习与整理 -------------------------------------------------------------------------------- /debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #开发环境配置 3 | cd server 4 | export LOBSTER_HOST_IP='127.0.0.1' 5 | export LOBSTER_REDIS_HOST='192.168.2.21' 6 | export LOBSTER_REDIS_PORT=6380 7 | export LOBSTER_REDIS_PWD='xx' 8 | 9 | export LOBSTER_MYSQL_HOST='192.168.2.2' 10 | export LOBSTER_MYSQL_PORT=3306 11 | export LOBSTER_MYSQL_USER='root' 12 | export LOBSTER_MYSQL_DB_GAME='xxx' 13 | export LOBSTER_MYSQL_PWD='xxx' 14 | 15 | export LOBSTER_SET_FILE='setting.server_setting' 16 | 17 | 18 | ./run.sh loginserver 19 | -------------------------------------------------------------------------------- /depends/cjson.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/cjson.so -------------------------------------------------------------------------------- /depends/lfs.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/lfs.so -------------------------------------------------------------------------------- /depends/lsocket.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/lsocket.so -------------------------------------------------------------------------------- /depends/lsocket/README.md: -------------------------------------------------------------------------------- 1 | lsocket 2 | ======= 3 | 4 | simple and easy socket support for lua 5 | 6 | http://tset.de/lsocket/ 7 | 8 | -------------------------------------------------------------------------------- /depends/lsocket/lsocket-1.3-1.rockspec: -------------------------------------------------------------------------------- 1 | package = "lsocket" 2 | version = "1.3-1" 3 | source = { 4 | url = "http://www.tset.de/downloads/lsocket-1.3-1.tar.gz" 5 | } 6 | description = { 7 | summary = "simple and easy socket support for lua.", 8 | detailed = [[ 9 | lsocket is a library to provide socket programming support for 10 | lua. It is not intended to be a complete socket api, but easy to 11 | use and good enough for most tasks. Both IPv4 and IPv6 are 12 | supported, as are tcp and udp, and also IPv4 broadcasts and 13 | IPv6 multicasts. 14 | ]], 15 | homepage = "http://www.tset.de/lsocket/", 16 | license = "MIT", 17 | maintainer = "Gunnar Zötl " 18 | } 19 | supported_platforms = { 20 | "unix" 21 | } 22 | dependencies = { 23 | "lua >= 5.1, < 5.3" 24 | } 25 | 26 | build = { 27 | type = "builtin", 28 | modules = { 29 | lsocket = { 30 | sources = { "lsocket.c" }, 31 | }, 32 | }, 33 | copy_directories = { 'doc', 'samples' }, 34 | } 35 | -------------------------------------------------------------------------------- /depends/lsocket/lsocket.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/lsocket/lsocket.o -------------------------------------------------------------------------------- /depends/lsocket/lsocket.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/lsocket/lsocket.so -------------------------------------------------------------------------------- /depends/lsocket/samples/testclt_mcast.lua: -------------------------------------------------------------------------------- 1 | -- very simple multicast test client, just listens to a multicast address 2 | -- and prints what it receives. 3 | -- Demonstrates how to set up a multicast client socket and read data 4 | -- from it. 5 | -- 6 | -- Gunnar Zötl , 2013-03 7 | -- Do what you will with this. 8 | 9 | if arg[1] == '6' then 10 | addr = 'ff01::1' 11 | else 12 | addr = '127.255.255.255' 13 | end 14 | port = 8000 15 | 16 | ls = require "lsocket" 17 | 18 | client, err = ls.bind('mcast', addr, port) 19 | if not client then 20 | print("error: "..err) 21 | os.exit(1) 22 | end 23 | 24 | print "Socket info:" 25 | for k, v in pairs(client:info()) do 26 | io.write(k..": "..tostring(v)..", ") 27 | end 28 | sock = client:info("socket") 29 | print("\nSocket: "..sock.family.." "..sock.addr..":"..sock.port) 30 | 31 | repeat 32 | ls.select {client} 33 | str, ip, port = client:recvfrom() 34 | if str then 35 | print("received from "..ip..":"..port..": "..str) 36 | else 37 | print("error: "..ip) 38 | end 39 | until false 40 | 41 | client:close() 42 | -------------------------------------------------------------------------------- /depends/lua-codec/src/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | gcc -Wall -O2 -shared -o codec.so codec.c -lcrypto -fPIC 3 | 4 | clean: 5 | rm -f codec.so 6 | -------------------------------------------------------------------------------- /depends/lua-codec/test/test.lua: -------------------------------------------------------------------------------- 1 | local codec = require('codec') 2 | 3 | for k, v in pairs(codec) do 4 | print(k, type(v)) 5 | end 6 | -------------------------------------------------------------------------------- /depends/lua-codec/test/test_aes.lua: -------------------------------------------------------------------------------- 1 | local codec = require('codec') 2 | local src, key = '123456', '01234567890abcdef' 3 | local bs = codec.aes_encrypt(src, key) 4 | local dst = codec.base64_encode(bs) 5 | print(dst) 6 | 7 | local dbs = codec.base64_decode(dst) 8 | local dsrc = codec.aes_decrypt(dbs, key) 9 | print(dsrc) 10 | 11 | assert(dsrc == src) 12 | -------------------------------------------------------------------------------- /depends/lua-codec/test/test_base64.lua: -------------------------------------------------------------------------------- 1 | local codec = require('codec') 2 | local src = '123456' 3 | local dst = codec.base64_encode(src) 4 | print(dst) 5 | local dsrc = codec.base64_decode(dst) 6 | print(dsrc) 7 | assert(dsrc == src) 8 | -------------------------------------------------------------------------------- /depends/lua-codec/test/test_hmac_sha1.lua: -------------------------------------------------------------------------------- 1 | local codec = require('codec') 2 | local src, key = '123456', '112233' 3 | local dst = codec.md5_encode(src) 4 | print(dst) 5 | assert('06285a0e4a99a56f7f9d1e239acad4de7c79ebe9' == dst) 6 | -------------------------------------------------------------------------------- /depends/lua-codec/test/test_md5.lua: -------------------------------------------------------------------------------- 1 | local codec = require('codec') 2 | local src = '123456' 3 | local dst = codec.md5_encode(src) 4 | print(dst) 5 | assert('e10adc3949ba59abbe56e057f20f883e' == dst) 6 | -------------------------------------------------------------------------------- /depends/lua-lfs/.gitignore: -------------------------------------------------------------------------------- 1 | *.so 2 | 3 | -------------------------------------------------------------------------------- /depends/lua-lfs/.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | 3 | sudo: false 4 | 5 | env: 6 | - LUA="lua 5.1" 7 | - LUA="lua 5.2" 8 | - LUA="lua 5.3" 9 | - LUA="luajit 2.0" 10 | 11 | before_install: 12 | - pip install --user cpp-coveralls hererocks 13 | - hererocks env --$LUA --luarocks latest 14 | - export PATH="$PWD/env/bin:$PATH" 15 | - luarocks install Lua-cURL --server=https://luarocks.org/dev 16 | - luarocks install lua-path 17 | - luarocks install lua-cjson 18 | - luarocks install luacov 19 | # install luacov-coveralls, but avoids installing luafilesystem 20 | - luarocks install luacov-coveralls --server=https://luarocks.org/dev --deps-mode=none 21 | 22 | install: 23 | - luarocks make rockspecs/luafilesystem-cvs-3.rockspec CFLAGS="-O2 -fPIC -ftest-coverage -fprofile-arcs" LIBFLAG="-shared --coverage" 24 | 25 | script: 26 | - lua -lluacov tests/test.lua 27 | 28 | after_success: 29 | - coveralls -b . -i src --dump c.report.json 30 | - luacov-coveralls -j c.report.json -v 31 | 32 | notifications: 33 | email: 34 | on_success: change 35 | on_failure: always 36 | -------------------------------------------------------------------------------- /depends/lua-lfs/Makefile: -------------------------------------------------------------------------------- 1 | # $Id: Makefile,v 1.36 2009/09/21 17:02:44 mascarenhas Exp $ 2 | 3 | T= lfs 4 | 5 | CONFIG= ./config 6 | 7 | include $(CONFIG) 8 | 9 | SRCS= src/$T.c 10 | OBJS= src/$T.o 11 | 12 | lib: src/lfs.so 13 | 14 | src/lfs.so: $(OBJS) 15 | MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; $(CC) $(LIB_OPTION) -o src/lfs.so $(OBJS) 16 | 17 | test: lib 18 | LUA_CPATH=./src/?.so lua tests/test.lua 19 | 20 | install: 21 | mkdir -p $(LUA_LIBDIR) 22 | cp src/lfs.so $(LUA_LIBDIR) 23 | 24 | clean: 25 | rm -f src/lfs.so $(OBJS) 26 | -------------------------------------------------------------------------------- /depends/lua-lfs/Makefile.win: -------------------------------------------------------------------------------- 1 | # $Id: Makefile.win,v 1.11 2008/05/07 19:06:37 carregal Exp $ 2 | 3 | T= lfs 4 | 5 | include config.win 6 | 7 | SRCS= src\$T.c 8 | OBJS= src\$T.obj 9 | 10 | lib: src\lfs.dll 11 | 12 | .c.obj: 13 | $(CC) /c /Fo$@ $(CFLAGS) $< 14 | 15 | src\lfs.dll: $(OBJS) 16 | link /dll /def:src\$T.def /out:src\lfs.dll $(OBJS) "$(LUA_LIB)" 17 | IF EXIST src\lfs.dll.manifest mt -manifest src\lfs.dll.manifest -outputresource:src\lfs.dll;2 18 | 19 | install: src\lfs.dll 20 | IF NOT EXIST "$(LUA_LIBDIR)" mkdir "$(LUA_LIBDIR)" 21 | copy src\lfs.dll "$(LUA_LIBDIR)" 22 | 23 | clean: 24 | del src\lfs.dll $(OBJS) src\$T.lib src\$T.exp 25 | IF EXIST src\lfs.dll.manifest del src\lfs.dll.manifest -------------------------------------------------------------------------------- /depends/lua-lfs/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 0.0.1.{build}-test 2 | 3 | # Use default image unless needed 4 | #os: 5 | #- Windows Server 2012 R2 6 | 7 | shallow_clone: true 8 | 9 | environment: 10 | matrix: 11 | - LUA: "lua 5.1" 12 | - LUA: "lua 5.2 --compat none" 13 | - LUA: "lua 5.3 --compat none" 14 | - LUA: "luajit 2.0" 15 | - LUA: "luajit 2.1" 16 | 17 | # Abuse this section so we can have a matrix with different Compiler versions 18 | configuration: 19 | - mingw 20 | - vs_32 21 | - vs_64 22 | 23 | install: 24 | - set PATH=%CD%\env\bin;C:\Python27\Scripts;C:\MinGW\bin;%PATH% 25 | - pip install hererocks 26 | - hererocks env --%LUA% --target %configuration% --luarocks latest 27 | 28 | before_build: 29 | # @todo 30 | - echo "Installing external deps" 31 | 32 | build_script: 33 | - luarocks make rockspecs/luafilesystem-cvs-3.rockspec 34 | 35 | before_test: 36 | 37 | test_script: 38 | - echo "Testing..." 39 | - lua tests/test.lua 40 | 41 | after_test: 42 | # @todo 43 | -------------------------------------------------------------------------------- /depends/lua-lfs/config: -------------------------------------------------------------------------------- 1 | # Installation directories 2 | 3 | # Default installation prefix 4 | PREFIX=/usr/local 5 | 6 | # System's libraries directory (where binary libraries are installed) 7 | LUA_LIBDIR= $(PREFIX)/lib/lua/5.1 8 | 9 | # Lua includes directory 10 | LUA_INC= $(PREFIX)/include 11 | 12 | # OS dependent 13 | LIB_OPTION= -shared #for Linux 14 | #LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X 15 | 16 | LIBNAME= $T.so.$V 17 | 18 | # Compilation directives 19 | WARN= -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -pedantic 20 | INCS= -I$(LUA_INC) 21 | CFLAGS= $(WARN) $(INCS) 22 | CC= gcc 23 | 24 | # $Id: config,v 1.21 2007/10/27 22:42:32 carregal Exp $ 25 | -------------------------------------------------------------------------------- /depends/lua-lfs/config.win: -------------------------------------------------------------------------------- 1 | # Installation directories 2 | # System's libraries directory (where binary libraries are installed) 3 | LUA_LIBDIR= "c:\lua5.1" 4 | 5 | # Lua includes directory 6 | LUA_INC= "c:\lua5.1\include" 7 | 8 | # Lua library 9 | LUA_LIB= "c:\lua5.1\lua5.1.lib" 10 | 11 | LIBNAME= $T.dll 12 | 13 | # Compilation directives 14 | WARN= /O2 15 | INCS= /I$(LUA_INC) 16 | CFLAGS= /MD $(WARN) $(INCS) 17 | CC= cl 18 | 19 | # $Id: config.win,v 1.7 2008/03/25 17:39:29 mascarenhas Exp $ 20 | -------------------------------------------------------------------------------- /depends/lua-lfs/rockspecs/luafilesystem-1.3.0-1.rockspec: -------------------------------------------------------------------------------- 1 | package = "LuaFileSystem" 2 | version = "1.3.0-1" 3 | source = { 4 | url = "http://luaforge.net/frs/download.php/2679/luafilesystem-1.3.0.tar.gz" 5 | } 6 | description = { 7 | summary = "File System Library for the Lua Programming Language", 8 | detailed = [[ 9 | LuaFileSystem is a Lua library developed to complement the set of 10 | functions related to file systems offered by the standard Lua 11 | distribution. LuaFileSystem offers a portable way to access the 12 | underlying directory structure and file attributes. 13 | ]] 14 | } 15 | dependencies = { 16 | "lua >= 5.1" 17 | } 18 | build = { 19 | type = "make", 20 | build_variables = { 21 | LUA_INC = "$(LUA_INCDIR)", 22 | LIB_OPTION = "$(LIBFLAG)" 23 | }, 24 | install_variables = { 25 | LUA_LIBDIR = "$(LIBDIR)" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /depends/lua-lfs/rockspecs/luafilesystem-1.4.0-1.rockspec: -------------------------------------------------------------------------------- 1 | package = "LuaFileSystem" 2 | version = "1.4.0-1" 3 | source = { 4 | url = "http://luaforge.net/frs/download.php/3158/luafilesystem-1.4.0.tar.gz" 5 | } 6 | description = { 7 | summary = "File System Library for the Lua Programming Language", 8 | detailed = [[ 9 | LuaFileSystem is a Lua library developed to complement the set of 10 | functions related to file systems offered by the standard Lua 11 | distribution. LuaFileSystem offers a portable way to access the 12 | underlying directory structure and file attributes. 13 | ]] 14 | } 15 | dependencies = { 16 | "lua >= 5.1" 17 | } 18 | build = { 19 | type = "make", 20 | build_variables = { 21 | LUA_INC = "$(LUA_INCDIR)", 22 | LIB_OPTION = "$(LIBFLAG)" 23 | }, 24 | install_variables = { 25 | LUA_LIBDIR = "$(LIBDIR)" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /depends/lua-lfs/rockspecs/luafilesystem-1.4.2-1.rockspec: -------------------------------------------------------------------------------- 1 | package = "LuaFileSystem" 2 | 3 | version = "1.4.2-1" 4 | 5 | source = { 6 | url = "http://luaforge.net/frs/download.php/3931/luafilesystem-1.4.2.tar.gz", 7 | } 8 | 9 | description = { 10 | summary = "File System Library for the Lua Programming Language", 11 | detailed = [[ 12 | LuaFileSystem is a Lua library developed to complement the set of 13 | functions related to file systems offered by the standard Lua 14 | distribution. LuaFileSystem offers a portable way to access the 15 | underlying directory structure and file attributes. 16 | ]] 17 | } 18 | 19 | dependencies = { 20 | "lua >= 5.1" 21 | } 22 | 23 | build = { 24 | type = "module", 25 | modules = { lfs = "src/lfs.c" } 26 | } -------------------------------------------------------------------------------- /depends/lua-lfs/rockspecs/luafilesystem-1.5.0-1.rockspec: -------------------------------------------------------------------------------- 1 | package = "LuaFileSystem" 2 | 3 | version = "1.5.0-1" 4 | 5 | source = { 6 | url = "http://cloud.github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.5.0.tar.gz", 7 | } 8 | 9 | description = { 10 | summary = "File System Library for the Lua Programming Language", 11 | detailed = [[ 12 | LuaFileSystem is a Lua library developed to complement the set of 13 | functions related to file systems offered by the standard Lua 14 | distribution. LuaFileSystem offers a portable way to access the 15 | underlying directory structure and file attributes. 16 | ]] 17 | } 18 | 19 | dependencies = { 20 | "lua >= 5.1" 21 | } 22 | 23 | build = { 24 | type = "module", 25 | modules = { lfs = "src/lfs.c" }, 26 | copy_directories = { "doc", "tests" } 27 | } 28 | -------------------------------------------------------------------------------- /depends/lua-lfs/rockspecs/luafilesystem-1.6.0-1.rockspec: -------------------------------------------------------------------------------- 1 | package = "LuaFileSystem" 2 | 3 | version = "1.6.0-1" 4 | 5 | source = { 6 | url = "https://github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.6.0.tar.gz", 7 | } 8 | 9 | description = { 10 | summary = "File System Library for the Lua Programming Language", 11 | detailed = [[ 12 | LuaFileSystem is a Lua library developed to complement the set of 13 | functions related to file systems offered by the standard Lua 14 | distribution. LuaFileSystem offers a portable way to access the 15 | underlying directory structure and file attributes. 16 | ]] 17 | } 18 | 19 | dependencies = { 20 | "lua >= 5.1" 21 | } 22 | 23 | build = { 24 | type = "builtin", 25 | modules = { lfs = "src/lfs.c" }, 26 | copy_directories = { "doc", "tests" } 27 | } 28 | -------------------------------------------------------------------------------- /depends/lua-lfs/rockspecs/luafilesystem-1.6.1-1.rockspec: -------------------------------------------------------------------------------- 1 | package = "LuaFileSystem" 2 | 3 | version = "1.6.1-1" 4 | 5 | source = { 6 | url = "https://github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.6.1.tar.gz", 7 | } 8 | 9 | description = { 10 | summary = "File System Library for the Lua Programming Language", 11 | detailed = [[ 12 | LuaFileSystem is a Lua library developed to complement the set of 13 | functions related to file systems offered by the standard Lua 14 | distribution. LuaFileSystem offers a portable way to access the 15 | underlying directory structure and file attributes. 16 | ]] 17 | } 18 | 19 | dependencies = { 20 | "lua >= 5.1" 21 | } 22 | 23 | build = { 24 | type = "builtin", 25 | modules = { lfs = "src/lfs.c" }, 26 | copy_directories = { "doc", "tests" } 27 | } 28 | -------------------------------------------------------------------------------- /depends/lua-lfs/rockspecs/luafilesystem-1.6.2-1.rockspec: -------------------------------------------------------------------------------- 1 | package = "LuaFileSystem" 2 | 3 | version = "1.6.2-1" 4 | 5 | source = { 6 | url = "https://github.com/downloads/keplerproject/luafilesystem/luafilesystem-1.6.2.tar.gz", 7 | } 8 | 9 | description = { 10 | summary = "File System Library for the Lua Programming Language", 11 | detailed = [[ 12 | LuaFileSystem is a Lua library developed to complement the set of 13 | functions related to file systems offered by the standard Lua 14 | distribution. LuaFileSystem offers a portable way to access the 15 | underlying directory structure and file attributes. 16 | ]] 17 | } 18 | 19 | dependencies = { 20 | "lua >= 5.1" 21 | } 22 | 23 | build = { 24 | type = "builtin", 25 | modules = { lfs = "src/lfs.c" }, 26 | copy_directories = { "doc", "tests" } 27 | } 28 | -------------------------------------------------------------------------------- /depends/lua-lfs/rockspecs/luafilesystem-1.6.3-1.rockspec: -------------------------------------------------------------------------------- 1 | package = "LuaFileSystem" 2 | version = "1.6.3-1" 3 | source = { 4 | url = "git://github.com/keplerproject/luafilesystem", 5 | tag = "v_1_6_3", 6 | } 7 | description = { 8 | summary = "File System Library for the Lua Programming Language", 9 | detailed = [[ 10 | LuaFileSystem is a Lua library developed to complement the set of 11 | functions related to file systems offered by the standard Lua 12 | distribution. LuaFileSystem offers a portable way to access the 13 | underlying directory structure and file attributes. 14 | ]], 15 | license = "MIT/X11", 16 | } 17 | dependencies = { 18 | "lua >= 5.1" 19 | } 20 | build = { 21 | type = "builtin", 22 | modules = { 23 | lfs = "src/lfs.c" 24 | }, 25 | copy_directories = { 26 | "doc", "tests" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /depends/lua-lfs/rockspecs/luafilesystem-cvs-2.rockspec: -------------------------------------------------------------------------------- 1 | package = "LuaFileSystem" 2 | 3 | version = "cvs-2" 4 | 5 | source = { 6 | url = "git://github.com/keplerproject/luafilesystem.git", 7 | } 8 | 9 | description = { 10 | summary = "File System Library for the Lua Programming Language", 11 | detailed = [[ 12 | LuaFileSystem is a Lua library developed to complement the set of 13 | functions related to file systems offered by the standard Lua 14 | distribution. LuaFileSystem offers a portable way to access the 15 | underlying directory structure and file attributes. 16 | ]] 17 | } 18 | 19 | dependencies = { 20 | "lua >= 5.1" 21 | } 22 | 23 | build = { 24 | type = "module", 25 | modules = { lfs = "src/lfs.c" } 26 | } 27 | -------------------------------------------------------------------------------- /depends/lua-lfs/rockspecs/luafilesystem-cvs-3.rockspec: -------------------------------------------------------------------------------- 1 | package = "LuaFileSystem" 2 | 3 | version = "cvs-3" 4 | 5 | source = { 6 | url = "git://github.com/keplerproject/luafilesystem.git", 7 | } 8 | 9 | description = { 10 | summary = "File System Library for the Lua Programming Language", 11 | detailed = [[ 12 | LuaFileSystem is a Lua library developed to complement the set of 13 | functions related to file systems offered by the standard Lua 14 | distribution. LuaFileSystem offers a portable way to access the 15 | underlying directory structure and file attributes. 16 | ]] 17 | } 18 | 19 | dependencies = { 20 | "lua >= 5.1, < 5.4" 21 | } 22 | 23 | build = { 24 | type = "builtin", 25 | modules = { lfs = "src/lfs.c" }, 26 | copy_directories = { "doc", "tests" } 27 | } 28 | -------------------------------------------------------------------------------- /depends/lua-lfs/src/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.so 3 | -------------------------------------------------------------------------------- /depends/lua-lfs/src/lfs.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** LuaFileSystem 3 | ** Copyright Kepler Project 2003 - 2016 (http://keplerproject.github.io/luafilesystem) 4 | */ 5 | 6 | /* Define 'chdir' for systems that do not implement it */ 7 | #ifdef NO_CHDIR 8 | #define chdir(p) (-1) 9 | #define chdir_error "Function 'chdir' not provided by system" 10 | #else 11 | #define chdir_error strerror(errno) 12 | #endif 13 | 14 | #ifdef _WIN32 15 | #define chdir(p) (_chdir(p)) 16 | #define getcwd(d, s) (_getcwd(d, s)) 17 | #define rmdir(p) (_rmdir(p)) 18 | #define LFS_EXPORT __declspec (dllexport) 19 | #ifndef fileno 20 | #define fileno(f) (_fileno(f)) 21 | #endif 22 | #else 23 | #define LFS_EXPORT 24 | #endif 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | LFS_EXPORT int luaopen_lfs (lua_State *L); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /depends/lua-lfs/tests/servermsg.proto: -------------------------------------------------------------------------------- 1 | // See README.txt for information and build instructions. 2 | // syntax = "proto2"; 3 | 4 | //message BackupTabledata { 5 | // optional int32 id = 1; //桌子ID 6 | // optional string name = 2; //桌子名称 地址 7 | //} 8 | 9 | //message Qbackupdata 10 | //{ 11 | // optional string roomsvr_id = 1; //房间服务器id 12 | // optional BackupTabledata backtabledata = 2; 13 | //} 14 | 15 | 16 | //message QrequestRecovery { 17 | // optional string roomsvr_id = 1; //房间服务器id 18 | // optional int32 id = 2; //桌子ID 19 | //} 20 | 21 | //message ArequestRecovery { 22 | // optional string roomsvr_id = 1; //房间服务器id 23 | //optional BackupTabledata backtabledata = 2; 24 | // } 25 | 26 | -------------------------------------------------------------------------------- /depends/lua-lfs/tests/testdir.lua: -------------------------------------------------------------------------------- 1 | local lfs = require"lfs" 2 | 3 | function attrdir (path) 4 | for file in lfs.dir(path) do 5 | if file ~= "." and file ~= ".." then 6 | local f = path..'/'..file 7 | print ("\t "..f) 8 | end 9 | end 10 | end 11 | 12 | attrdir(".") -------------------------------------------------------------------------------- /depends/lua-openssl/.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.o 3 | *.ko 4 | *.obj 5 | *.elf 6 | 7 | # Libraries 8 | *.lib 9 | *.a 10 | 11 | # Shared objects (inc. Windows DLLs) 12 | *.dll 13 | *.so 14 | *.so.* 15 | *.dylib 16 | 17 | # Executables 18 | *.exe 19 | *.out 20 | *.app 21 | *.i*86 22 | *.x86_64 23 | *.hex 24 | 25 | #MSVC 26 | msvc/ 27 | 28 | #ldoc 29 | doc/ 30 | 31 | #lake deps 32 | *.d 33 | 34 | #misc 35 | *.orgi 36 | /doc 37 | /src/custom.h 38 | oscca/ 39 | tmp/ 40 | -------------------------------------------------------------------------------- /depends/lua-openssl/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "deps/lua-compat"] 2 | path = deps/lua-compat 3 | url = https://github.com/hishamhm/lua-compat-5.2.git 4 | -------------------------------------------------------------------------------- /depends/lua-openssl/.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | 3 | sudo: required 4 | env: 5 | global: 6 | - LUAROCKS=2.2.2 7 | matrix: 8 | - LUA=lua5.1 9 | - LUA=lua5.2 10 | - LUA=lua5.3 11 | - LUA=luajit 12 | 13 | os: 14 | - linux 15 | - osx 16 | 17 | 18 | branches: 19 | only: 20 | - master 21 | 22 | before_install: 23 | - source .travis/setenv_lua.sh 24 | - bash .travis/setup_uv.sh 25 | - git submodule update --init --recursive 26 | - git submodule update --recursive 27 | 28 | install: 29 | - 'if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sudo $HOME/.lua/luarocks make rockspecs/openssl-scm-1.rockspec OPENSSL_DIR="/usr/local/opt/openssl"; fi' 30 | - 'if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo $HOME/.lua/luarocks make rockspecs/openssl-scm-1.rockspec; fi' 31 | 32 | script: 33 | - cd test 34 | - curl https://raw.githubusercontent.com/bluebird75/luaunit/master/luaunit.lua > luaunit.lua 35 | - lua test.lua 36 | 37 | notifications: 38 | email: 39 | on_success: change 40 | on_failure: always 41 | -------------------------------------------------------------------------------- /depends/lua-openssl/.travis/platform.sh: -------------------------------------------------------------------------------- 1 | if [ -z "${PLATFORM:-}" ]; then 2 | PLATFORM=$TRAVIS_OS_NAME; 3 | fi 4 | 5 | if [ "$PLATFORM" == "osx" ]; then 6 | PLATFORM="macosx"; 7 | fi 8 | 9 | if [ -z "$PLATFORM" ]; then 10 | if [ "$(uname)" == "Linux" ]; then 11 | PLATFORM="linux"; 12 | else 13 | PLATFORM="macosx"; 14 | fi; 15 | fi 16 | 17 | if [ "$PLATFORM" == "macosx" ]; then 18 | echo update openssl; 19 | brew update; 20 | brew install openssl; 21 | brew link --force openssl; 22 | fi 23 | -------------------------------------------------------------------------------- /depends/lua-openssl/.travis/setenv_lua.sh: -------------------------------------------------------------------------------- 1 | export PATH=${PATH}:$HOME/.lua:$HOME/.local/bin:${TRAVIS_BUILD_DIR}/install/luarocks/bin 2 | bash .travis/setup_lua.sh 3 | eval `$HOME/.lua/luarocks path` 4 | -------------------------------------------------------------------------------- /depends/lua-openssl/.travis/setup_uv.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | source .travis/platform.sh 4 | 5 | cd $TRAVIS_BUILD_DIR 6 | git clone https://github.com/luvit/luv 7 | cd luv 8 | git submodule update --init --recursive 9 | git submodule update --recursive 10 | 11 | sudo add-apt-repository --yes ppa:kalakris/cmake 12 | sudo apt-get update -qq 13 | sudo apt-get install cmake 14 | 15 | make 16 | sudo cp luv.so /usr/local/lib/lua/`luajit -e "_,_,v=string.find(_VERSION,'Lua (.+)');print(v)"` 17 | 18 | cd $TRAVIS_BUILD_DIR 19 | -------------------------------------------------------------------------------- /depends/lua-openssl/STATE.md: -------------------------------------------------------------------------------- 1 | 2 | compat with luasec 0.5 test result 3 | ---------------------- 4 | 5 | please see test/luasc 6 | 7 | |what |Result |Desc | 8 | |------------|-------|--------| 9 | |certs |* |Not Lua | 10 | |chain |pass | | 11 | |dhparam |pass | | 12 | |digest |pass | | 13 | |ecdh |pass | | 14 | |info |pass | | 15 | |key |pass | | 16 | |loop |pass | | 17 | |loop-gc |pass | | 18 | |oneshot |pass | | 19 | |verification|pass | | 20 | |+fail-string|pass | | 21 | |+fail-table |pass | | 22 | |+success |pass | | 23 | |verify |pass | | 24 | |wantread |NYI | | 25 | |wantwrite |NYI | | 26 | |want |NYI | | 27 | -------------------------------------------------------------------------------- /depends/lua-openssl/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 0.4.{build} 2 | configuration: Release 3 | platform: x86 4 | clone_depth: 2 5 | clone_folder: C:\lua-openssl 6 | install: 7 | - cd c:\lua-openssl 8 | - git submodule update --init --recursive 9 | - git submodule update --recursive 10 | - '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86' 11 | - cd C:\ 12 | - ps: Start-FileDownload 'https://github.com/zhaozg/openssl-win32/blob/1.0.2/misc/luv.dll?raw=true' -FileName 'C:\luv.dll' 13 | #- git clone https://github.com/zhaozg/openssl-win32.git C:\openssl-win32 14 | - git clone http://luajit.org/git/luajit-2.0.git C:\luajit-2.0 15 | build_script: 16 | - cd c:\luajit-2.0\src 17 | - msvcbuild.bat 18 | - copy luajit.exe C:\ 19 | - copy lua51.* C:\ 20 | - cd c:\lua-openssl 21 | - nmake -f makefile.win 22 | - copy src\openssl.dll c:\ 23 | test_script: 24 | - cd test\ 25 | - set LUA_PATH=?.lua; 26 | - set LUA_CPATH=C:\?.dll; 27 | - c:\luajit.exe test.lua 28 | -------------------------------------------------------------------------------- /depends/lua-openssl/config.win: -------------------------------------------------------------------------------- 1 | # Installation directories 2 | # System's libraries directory (where binary libraries are installed) 3 | LUA_LIBDIR= "d:\work\luabuild\bin\Win32Debug\clibs\" 4 | 5 | # Lua includes and lib 6 | LUA_INC= "c:\luajit-2.0\src" 7 | LUA_LIB= "c:\luajit-2.0\src\lua51.lib" 8 | 9 | # Openssl include and lib 10 | OPENSSL_INC="c:\openssl-win32\include" 11 | OPENSSL_LIB="c:\openssl-win32\lib\libeay32.lib c:\openssl-win32\lib\ssleay32.lib" 12 | 13 | LIBNAME= $T.dll 14 | 15 | # Compilation directives 16 | WARN= /O2 17 | INCS= /I$(LUA_INC) /I$(OPENSSL_INC) /Ideps 18 | CFLAGS= /DWIN32_LEAN_AND_MEAN /MD $(WARN) $(INCS) 19 | CC= cl 20 | 21 | -------------------------------------------------------------------------------- /depends/lua-openssl/ldoc/config.ld: -------------------------------------------------------------------------------- 1 | project='lua-openssl' 2 | title='lua-openssl Docmentation' 3 | description='Openssl binding for Lua' 4 | format='discount' 5 | backtick_references=false 6 | file={ 7 | 'openssl.lua', 8 | 'asn1.lua', 9 | 'bio.lua', 10 | 'cipher.lua', 11 | 'digest.lua', 12 | 'hmac.lua', 13 | 'pkey.lua', 14 | 'x509.lua', 15 | 'x509_name.lua', 16 | 'x509_extension.lua', 17 | 'x509_attr.lua', 18 | 'x509_req.lua', 19 | 'x509_crl.lua', 20 | 'x509_store.lua', 21 | 'pkcs7.lua', 22 | 'cms.lua', 23 | 'pkcs12.lua', 24 | 'timestamp.lua', 25 | 'ssl.lua', 26 | 'sk.lua' 27 | } 28 | dir='doc' 29 | readme='README.md' 30 | style='!pale' 31 | kind_names={topic='Manual',script='Programs'} 32 | examples = { 33 | } -------------------------------------------------------------------------------- /depends/lua-openssl/ldoc/pkcs12.lua: -------------------------------------------------------------------------------- 1 | --- 2 | -- Provide pkcs12 function in lua. 3 | -- 4 | -- @module pkcs12 5 | -- @usage 6 | -- pkcs12 = require('openssl').pkcs12 7 | -- 8 | 9 | do -- define module function 10 | 11 | --- parse pkcs12 data as lua table 12 | -- 13 | -- @tparam string|bio input pkcs12 content 14 | -- @tparam string password for pkcs12 15 | -- @treturn table result contain 'cert', 'pkey', 'extracerts' keys 16 | function read() end 17 | 18 | --- create and export pkcs12 data 19 | -- @tparam x509 cert 20 | -- @tparam evp_pkey pkey 21 | -- @tparam string password 22 | -- @tparam[opt] string friendlyname 23 | -- @tparam[opt] table|stak_of_x509 extracerts 24 | -- @treturn string data 25 | function export() end 26 | 27 | end 28 | 29 | -------------------------------------------------------------------------------- /depends/lua-openssl/rockspecs/openssl-scm-0.rockspec: -------------------------------------------------------------------------------- 1 | package = "openssl" 2 | version = "scm-0" 3 | 4 | source = { 5 | url = "https://github.com/zhaozg/lua-openssl/archive/master.zip", 6 | dir = "lua-openssl-master", 7 | } 8 | 9 | description = { 10 | summary = "Openssl binding for Lua", 11 | homepage = "https://github.com/zhaozg/lua-openssl", 12 | license = "MIT/X11", 13 | maintainer = "George Zhao", 14 | detailed = [[ 15 | ]], 16 | } 17 | 18 | dependencies = { 19 | "lua >= 5.1, < 5.3" 20 | } 21 | 22 | external_dependencies = { 23 | } 24 | 25 | build = { 26 | type = "builtin", 27 | 28 | platforms = { 29 | windows = { 30 | type = "command", 31 | build_command = [[nmake -f makefile.win]], 32 | install_command = [[nmake -f makefile.win install]] 33 | }, 34 | unix = { 35 | type = "command", 36 | build_command = [[make]], 37 | install_command = [[make install]] 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /depends/lua-openssl/src/oids.txt: -------------------------------------------------------------------------------- 1 | # Do not edit this file, add your own OIDs in /etc/xca/oids.txt 2 | # or $HOME/xca 3 | 4 | # OID short name long name 5 | 1.3.6.1.4.1.311.20.2: dom: Domain Controller 6 | 1.3.6.1.4.1.311.21.1: MsCaV: Microsoft CA Version 7 | 1.3.6.1.4.1.311.20.2.3: msUPN: Microsoft Universal Principal Name 8 | 1.3.6.1.4.1.311.10.3.4.1:msEFSFR: Microsoft EFS File Recovery 9 | 1.3.6.1.5.5.8.2.2: iKEIntermediate: IP security end entity 10 | 1.3.6.1.5.5.7.3.1: serverAuth: Microsoft Server 11 | 1.3.6.1.5.5.7.3.2: clientAuth: Microsoft Client 12 | 1.3.6.1.4.1.311.20.2.2: msSmartcardLogin: Smart Card Logon 13 | 2.5.4.44: generationQualifier: generation Qualifier 14 | 2.5.4.45: x500UniqueIdentifier: x500 Unique Identifier 15 | 2.5.4.65: pseudonym: pseudonym 16 | 0.2.262.1.10.7.20: nameDistinguisher: Name distinguisher 17 | -------------------------------------------------------------------------------- /depends/lua-openssl/test/0.engine.lua: -------------------------------------------------------------------------------- 1 | local openssl = require'openssl' 2 | 3 | TestEngine = {} 4 | function TestEngine:testAll() 5 | local eng = assert(openssl.engine('openssl')) 6 | assert(eng:id(),'openssl') 7 | assert(eng:set_default('RSA')) 8 | assert(eng:set_default('ECDSA')) 9 | end 10 | 11 | function TestEngine:testLoop() 12 | local e = openssl.engine(true) 13 | while e do 14 | --print(e:id(), e:name()) 15 | e = e:next() 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /depends/lua-openssl/test/0.tcp_c.lua: -------------------------------------------------------------------------------- 1 | local openssl = require 'openssl' 2 | local bio = openssl.bio 3 | 4 | host = arg[1] or "127.0.0.1"; --only ip 5 | port = arg[2] or "8383"; 6 | loop = arg[3] and tonumber(arg[3]) or 100 7 | print(string.format('CONNECT to %s:%s',host,port)) 8 | 9 | function mk_connection(host,port) 10 | local cli = assert(bio.connect(host..':'..port,true)) 11 | if(cli) then 12 | s = 'aaa' 13 | io.write('.') 14 | for j=1,100 do 15 | assert(cli:write(s)) 16 | assert(cli:flush()) 17 | assert(cli:read()) 18 | end 19 | cli:shutdown() 20 | cli:close() 21 | cli = nil 22 | collectgarbage() 23 | end 24 | end 25 | 26 | for i=1,loop do 27 | mk_connection(host,port) 28 | end 29 | print(openssl.error(true)) 30 | -------------------------------------------------------------------------------- /depends/lua-openssl/test/0.tcp_s.lua: -------------------------------------------------------------------------------- 1 | local openssl = require 'openssl' 2 | local bio = openssl.bio 3 | 4 | host = arg[1] or "127.0.0.1"; --only ip 5 | port = arg[2] or "8383"; 6 | loop = arg[3] and tonumber(arg[3]) or 100 7 | 8 | print(string.format('Listen at %s:%s',host,port)) 9 | local i = 0; 10 | local srv = assert(bio.accept(host..':'..port)) 11 | if srv then 12 | assert(srv:accept(true)) -- make real listen 13 | while i 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /depends/lua-pbc/src/src/alloc.h: -------------------------------------------------------------------------------- 1 | #ifndef PROTOBUF_C_ALLOC_H 2 | #define PROTOBUF_C_ALLOC_H 3 | 4 | #include 5 | #include 6 | 7 | void * _pbcM_malloc(size_t sz); 8 | void _pbcM_free(void *p); 9 | void * _pbcM_realloc(void *p, size_t sz); 10 | void _pbcM_memory(); 11 | 12 | struct heap; 13 | 14 | struct heap * _pbcH_new(int pagesize); 15 | void _pbcH_delete(struct heap *); 16 | void* _pbcH_alloc(struct heap *, int size); 17 | 18 | #define HMALLOC(size) ((h) ? _pbcH_alloc(h, size) : _pbcM_malloc(size)) 19 | 20 | #define malloc _pbcM_malloc 21 | #define free _pbcM_free 22 | #define realloc _pbcM_realloc 23 | #define memory _pbcM_memory 24 | 25 | #ifdef _WIN32 26 | 27 | #include 28 | 29 | #endif 30 | 31 | #ifdef _MSC_VER 32 | 33 | #define alloca _alloca 34 | 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /depends/lua-pbc/src/src/array.h: -------------------------------------------------------------------------------- 1 | #ifndef PROTOBUF_C_ARRAY_H 2 | #define PROTOBUF_C_ARRAY_H 3 | 4 | #include "varint.h" 5 | #include "pbc.h" 6 | #include "alloc.h" 7 | 8 | typedef union _pbc_var { 9 | struct longlong integer; 10 | double real; 11 | struct { 12 | const char * str; 13 | int len; 14 | } s; 15 | struct { 16 | int id; 17 | const char * name; 18 | } e; 19 | struct pbc_slice m; 20 | void * p[2]; 21 | } pbc_var[1]; 22 | 23 | void _pbcA_open(pbc_array); 24 | void _pbcA_open_heap(pbc_array, struct heap *h); 25 | void _pbcA_close(pbc_array); 26 | 27 | void _pbcA_push(pbc_array, pbc_var var); 28 | void _pbcA_index(pbc_array , int idx, pbc_var var); 29 | void * _pbcA_index_p(pbc_array _array, int idx); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /depends/lua-pbc/src/src/bootstrap.h: -------------------------------------------------------------------------------- 1 | #ifndef PROTOBUF_C_BOOTSTRAP_H 2 | #define PROTOBUF_C_BOOTSTRAP_H 3 | 4 | #include "proto.h" 5 | #include "pbc.h" 6 | 7 | void _pbcB_init(struct pbc_env *); 8 | void _pbcB_register_fields(struct pbc_env *, pbc_array queue); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /depends/lua-pbc/src/src/pattern.h: -------------------------------------------------------------------------------- 1 | #ifndef PROTOBUF_C_PATTERN_H 2 | #define PROTOBUF_C_PATTERN_H 3 | 4 | #include "pbc.h" 5 | #include "context.h" 6 | #include "array.h" 7 | 8 | struct _pattern_field { 9 | int id; 10 | int offset; 11 | int ptype; 12 | int ctype; 13 | int label; 14 | pbc_var defv; 15 | }; 16 | 17 | struct pbc_pattern { 18 | struct pbc_env * env; 19 | int count; 20 | struct _pattern_field f[1]; 21 | }; 22 | 23 | struct pbc_pattern * _pbcP_new(struct pbc_env * env, int n); 24 | int _pbcP_unpack_packed(uint8_t *buffer, int size, int ptype, pbc_array array); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /depends/lua-pbc/src/src/stringpool.h: -------------------------------------------------------------------------------- 1 | #ifndef PROTOBUF_C_STRINGPOOL_H 2 | #define PROTOBUF_C_STRINGPOOL_H 3 | 4 | struct _stringpool; 5 | 6 | struct _stringpool * _pbcS_new(void); 7 | void _pbcS_delete(struct _stringpool *pool); 8 | const char * _pbcS_build(struct _stringpool *pool, const char * str , int sz); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /depends/lua-pbc/src/src/varint.h: -------------------------------------------------------------------------------- 1 | #ifndef PROTOBUF_C_VARINT_H 2 | #define PROTOBUF_C_VARINT_H 3 | 4 | #include 5 | 6 | struct longlong { 7 | uint32_t low; 8 | uint32_t hi; 9 | }; 10 | 11 | int _pbcV_encode32(uint32_t number, uint8_t buffer[10]); 12 | int _pbcV_encode(uint64_t number, uint8_t buffer[10]); 13 | int _pbcV_zigzag32(int32_t number, uint8_t buffer[10]); 14 | int _pbcV_zigzag(int64_t number, uint8_t buffer[10]); 15 | 16 | int _pbcV_decode(uint8_t buffer[10], struct longlong *result); 17 | void _pbcV_dezigzag64(struct longlong *r); 18 | void _pbcV_dezigzag32(struct longlong *r); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /depends/lua-pbc/src/test/array.c: -------------------------------------------------------------------------------- 1 | #include "pbc.h" 2 | #include "alloc.h" 3 | #include "array.h" 4 | 5 | #include 6 | 7 | int 8 | main() 9 | { 10 | pbc_array array; 11 | pbc_var v; 12 | 13 | _pbcA_open(array); 14 | 15 | int i ; 16 | 17 | for (i=0;i<100;i++) { 18 | v->real = (double)i; 19 | printf("push %d\n",i); 20 | _pbcA_push(array, v); 21 | } 22 | 23 | int s = pbc_array_size(array); 24 | 25 | for (i=0;ireal); 28 | } 29 | 30 | _pbcA_close(array); 31 | 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /depends/lua-pbc/src/test/float.proto: -------------------------------------------------------------------------------- 1 | message real { 2 | optional float f = 1; 3 | optional double d = 2; 4 | } 5 | -------------------------------------------------------------------------------- /depends/lua-pbc/src/test/readfile.h: -------------------------------------------------------------------------------- 1 | #ifndef readfile_h 2 | #define readfile_h 3 | 4 | #include 5 | #include 6 | 7 | static void 8 | read_file (const char *filename , struct pbc_slice *slice) { 9 | FILE *f = fopen(filename, "rb"); 10 | if (f == NULL) { 11 | slice->buffer = NULL; 12 | slice->len = 0; 13 | return; 14 | } 15 | fseek(f,0,SEEK_END); 16 | slice->len = ftell(f); 17 | fseek(f,0,SEEK_SET); 18 | slice->buffer = malloc(slice->len); 19 | if (fread(slice->buffer, 1 , slice->len , f) == 0) 20 | exit(1); 21 | fclose(f); 22 | } 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /depends/lua-pbc/src/test/test.proto: -------------------------------------------------------------------------------- 1 | message at { 2 | optional int32 aa = 1; 3 | optional int32 bb = 2; 4 | optional string cc = 3; 5 | } 6 | -------------------------------------------------------------------------------- /depends/lua-snapshot/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 codingow.com 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /depends/lua-snapshot/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY : all linux mingw 2 | 3 | all : linux 4 | 5 | linux : 6 | gcc -g -Wall -fPIC --shared -o snapshot.so snapshot.c 7 | 8 | mingw : 9 | gcc -g -Wall --shared -o snapshot.dll snapshot.c -I/usr/local/include -L/usr/local/bin -llua52 10 | 11 | mingw51 : 12 | gcc -g -Wall --shared -o snapshot.dll snapshot.c -I/usr/local/include -L/usr/local/bin -llua51 13 | 14 | macosx : 15 | gcc -g -Wall --shared -undefined dynamic_lookup -o snapshot.so snapshot.c 16 | -------------------------------------------------------------------------------- /depends/lua-snapshot/README.md: -------------------------------------------------------------------------------- 1 | lua-snapshot 2 | ============ 3 | 4 | Make a snapshot for lua state to detect memory leaks. 5 | 6 | See dump.lua for example. 7 | 8 | Build 9 | ===== 10 | 11 | make linux 12 | 13 | or 14 | 15 | make mingw (in windows) 16 | 17 | or 18 | 19 | make macosx 20 | -------------------------------------------------------------------------------- /depends/lua-snapshot/dump.lua: -------------------------------------------------------------------------------- 1 | local snapshot = require "snapshot" 2 | 3 | local S1 = snapshot() 4 | 5 | local tmp = {} 6 | 7 | local S2 = snapshot() 8 | 9 | for k,v in pairs(S2) do 10 | if S1[k] == nil then 11 | print(k,v) 12 | end 13 | end 14 | 15 | -------------------------------------------------------------------------------- /depends/protobuf.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/protobuf.so -------------------------------------------------------------------------------- /depends/skynet/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "3rd/jemalloc"] 2 | path = 3rd/jemalloc 3 | url = https://github.com/jemalloc/jemalloc.git 4 | -------------------------------------------------------------------------------- /depends/skynet/3rd/crab/.gitignore: -------------------------------------------------------------------------------- 1 | *.so 2 | 3 | -------------------------------------------------------------------------------- /depends/skynet/3rd/crab/Makefile: -------------------------------------------------------------------------------- 1 | all: utf8.so crab.so 2 | 3 | utf8.so: lua-utf8.c 4 | gcc -fPIC --shared -g -O0 -Wall -I/usr/local/include -o $@ $^ -L/usr/local/lib 5 | 6 | crab.so: lua-crab.c 7 | gcc -fPIC --shared -g -O0 -Wall -I/usr/local/include -o $@ $^ -L/usr/local/lib 8 | 9 | test: all 10 | lua test.lua 11 | 12 | test1: 13 | #./crab words.txt "热爱中国共产党, 响应中央号召" 14 | clean: 15 | rm crab 16 | -------------------------------------------------------------------------------- /depends/skynet/3rd/crab/README.md: -------------------------------------------------------------------------------- 1 | crab 2 | ==== 3 | 4 | crab 5 | 6 | limitation 7 | ---------- 8 | 9 | 10 | usage 11 | ----- 12 | $ make test 13 | 14 | make better 15 | ----------- 16 | 17 | -------------------------------------------------------------------------------- /depends/skynet/3rd/crab/test.lua: -------------------------------------------------------------------------------- 1 | local crab = require "crab.c" 2 | local utf8 = require "utf8.c" 3 | 4 | local words = {} 5 | for line in io.lines("words.txt") do 6 | local t = {} 7 | assert(utf8.toutf32(line, t), "non utf8 words detected:"..line) 8 | table.insert(words, t) 9 | end 10 | 11 | crab.open(words) 12 | 13 | local input = io.input("texts.txt"):read("*a") 14 | local texts = {} 15 | assert(utf8.toutf32(input, texts), "non utf8 words detected:", texts) 16 | crab.filter(texts) 17 | local output = utf8.toutf8(texts) 18 | 19 | print(output) 20 | 21 | -------------------------------------------------------------------------------- /depends/skynet/3rd/crab/texts.txt: -------------------------------------------------------------------------------- 1 | 那些意外,似乎来的早了些,也只能听从心的指引,去做到最好。 2 | 3 | 无论生死,还是离别,一次,真的足够了。 4 | 5 | 如果我不能带给你平静的喜乐,请你一定要远离我, 6 | 7 | 若你还爱我,舍不得,请珍惜我,给我安宁与平静的欢喜。 8 | 9 | 单薄的衣衫,翩跹在春风里,似乎有点瑟瑟。 10 | 11 | 凝眸花草,我彻底的寂寞着,有点心酸,有点心动,依然还有回眸的幸福。 12 | 13 | 床头的旧照片,还是我从电脑上临摹的,你温暖的眼神依旧,仿佛注视着我。 14 | 15 | 我爱极了瞳孔里的深邃,无眠的夜晚,我常常悄悄的与那个你对着话,也不知道聊着什么。 16 | 17 | 抚摸着那个轮廓,很近,又很远,依然不能阻止那些温暖,仿佛就在身边,在心底升腾着笑意。 18 | 19 | 心有所定,只是专注着,在人群中静静独立着,保持着一种完整的姿态,等待着。 20 | 21 | 从不是盲目的期待,也不是纠缠,我知道,我一直遇见着那颗心,那颗总能让我温暖的心。 22 | 23 | 或许,太过执着,总有些患得患失,心底寂静无声依赖着。 24 | 25 | 现世依旧安稳着,静静相守,一个人愿意跟另一个人一起老去,是一种最美的承诺。 26 | 27 | 我庆幸着,我没有一个人相思着,我爱着的人,如此爱着我。 28 | 29 | 这些寂寞,似乎是些折磨,又似乎是幸福,我可以有足够的时间,慢慢的想,慢慢的等。 30 | 31 | 相爱,是一场真心的对奕,从不怕辜负,我只怕我不能带给你快乐,若我不能,你一定要离开。 32 | 33 | 我的内心,那么的希望,你能找寻到自己的快乐。 34 | 35 | 梨花似雪的心情,遥望着,这个世界上,即使再阴暗的角落,也会有爱情的微光照耀。 36 | 37 | 我们终其一生寻找的,或许就是灵魂的安放地,不找到是无法罢休的。 38 | 39 | 或许,只是一种形式的亲近,亦或是一种心的贴近,有心,用心,安心,足够了。 40 | 41 | 人的一生,何其漫长,纵然遇到再多的人,那个对的只有你。 42 | 43 | 无论遇到谁,我已然没有爱的能力了,一次足够了,他们都不是你。 44 | 45 | 无论是否适合,我知道,自己的内心如此固执的深爱着。 46 | 47 | 凡此世间种种,或者都是因果循环。 48 | 49 | -------------------------------------------------------------------------------- /depends/skynet/3rd/crab/words.txt: -------------------------------------------------------------------------------- 1 | 意外 2 | 有点 3 | 有点心动 4 | 我一直 5 | 一个人 6 | 一种 7 | 一种麦子 8 | 一 9 | 可以有足够的时间 10 | 无论 11 | 生死 12 | 还是 13 | 离别 14 | 一次 15 | 真的足够了 16 | 从不 17 | 盲目 18 | 期待 19 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/.autom4te.cfg: -------------------------------------------------------------------------------- 1 | begin-language: "Autoconf-without-aclocal-m4" 2 | args: --no-cache 3 | end-language: "Autoconf-without-aclocal-m4" 4 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for i in autoconf; do 4 | echo "$i" 5 | $i 6 | if [ $? -ne 0 ]; then 7 | echo "Error $? in $i" 8 | exit 1 9 | fi 10 | done 11 | 12 | echo "./configure --enable-autogen $@" 13 | ./configure --enable-autogen $@ 14 | if [ $? -ne 0 ]; then 15 | echo "Error $? in ./configure" 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/bin/jemalloc.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | 7 | @LD_PRELOAD_VAR@=${libdir}/libjemalloc.@SOREV@ 8 | export @LD_PRELOAD_VAR@ 9 | exec "$@" 10 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/config.stamp.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/jemalloc/config.stamp.in -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/doc/html.xsl.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/doc/manpages.xsl.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/doc/stylesheet.xsl: -------------------------------------------------------------------------------- 1 | 2 | ansi 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/include/jemalloc/internal/arena_structs_a.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_ARENA_STRUCTS_A_H 2 | #define JEMALLOC_INTERNAL_ARENA_STRUCTS_A_H 3 | 4 | #include "jemalloc/internal/bitmap.h" 5 | 6 | struct arena_slab_data_s { 7 | /* Per region allocated/deallocated bitmap. */ 8 | bitmap_t bitmap[BITMAP_GROUPS_MAX]; 9 | }; 10 | 11 | #endif /* JEMALLOC_INTERNAL_ARENA_STRUCTS_A_H */ 12 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/include/jemalloc/internal/base_externs.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_BASE_EXTERNS_H 2 | #define JEMALLOC_INTERNAL_BASE_EXTERNS_H 3 | 4 | extern metadata_thp_mode_t opt_metadata_thp; 5 | extern const char *metadata_thp_mode_names[]; 6 | 7 | base_t *b0get(void); 8 | base_t *base_new(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks); 9 | void base_delete(tsdn_t *tsdn, base_t *base); 10 | extent_hooks_t *base_extent_hooks_get(base_t *base); 11 | extent_hooks_t *base_extent_hooks_set(base_t *base, 12 | extent_hooks_t *extent_hooks); 13 | void *base_alloc(tsdn_t *tsdn, base_t *base, size_t size, size_t alignment); 14 | extent_t *base_alloc_extent(tsdn_t *tsdn, base_t *base); 15 | void base_stats_get(tsdn_t *tsdn, base_t *base, size_t *allocated, 16 | size_t *resident, size_t *mapped, size_t *n_thp); 17 | void base_prefork(tsdn_t *tsdn, base_t *base); 18 | void base_postfork_parent(tsdn_t *tsdn, base_t *base); 19 | void base_postfork_child(tsdn_t *tsdn, base_t *base); 20 | bool base_boot(tsdn_t *tsdn); 21 | 22 | #endif /* JEMALLOC_INTERNAL_BASE_EXTERNS_H */ 23 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/include/jemalloc/internal/base_inlines.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_BASE_INLINES_H 2 | #define JEMALLOC_INTERNAL_BASE_INLINES_H 3 | 4 | static inline unsigned 5 | base_ind_get(const base_t *base) { 6 | return base->ind; 7 | } 8 | 9 | static inline bool 10 | metadata_thp_enabled(void) { 11 | return (opt_metadata_thp != metadata_thp_disabled); 12 | } 13 | #endif /* JEMALLOC_INTERNAL_BASE_INLINES_H */ 14 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/include/jemalloc/internal/base_types.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_BASE_TYPES_H 2 | #define JEMALLOC_INTERNAL_BASE_TYPES_H 3 | 4 | typedef struct base_block_s base_block_t; 5 | typedef struct base_s base_t; 6 | 7 | #define METADATA_THP_DEFAULT metadata_thp_disabled 8 | 9 | typedef enum { 10 | metadata_thp_disabled = 0, 11 | /* 12 | * Lazily enable hugepage for metadata. To avoid high RSS caused by THP 13 | * + low usage arena (i.e. THP becomes a significant percentage), the 14 | * "auto" option only starts using THP after a base allocator used up 15 | * the first THP region. Starting from the second hugepage (in a single 16 | * arena), "auto" behaves the same as "always", i.e. madvise hugepage 17 | * right away. 18 | */ 19 | metadata_thp_auto = 1, 20 | metadata_thp_always = 2, 21 | metadata_thp_mode_limit = 3 22 | } metadata_thp_mode_t; 23 | 24 | #endif /* JEMALLOC_INTERNAL_BASE_TYPES_H */ 25 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/include/jemalloc/internal/extent_dss.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_EXTENT_DSS_H 2 | #define JEMALLOC_INTERNAL_EXTENT_DSS_H 3 | 4 | typedef enum { 5 | dss_prec_disabled = 0, 6 | dss_prec_primary = 1, 7 | dss_prec_secondary = 2, 8 | 9 | dss_prec_limit = 3 10 | } dss_prec_t; 11 | #define DSS_PREC_DEFAULT dss_prec_secondary 12 | #define DSS_DEFAULT "secondary" 13 | 14 | extern const char *dss_prec_names[]; 15 | 16 | extern const char *opt_dss; 17 | 18 | dss_prec_t extent_dss_prec_get(void); 19 | bool extent_dss_prec_set(dss_prec_t dss_prec); 20 | void *extent_alloc_dss(tsdn_t *tsdn, arena_t *arena, void *new_addr, 21 | size_t size, size_t alignment, bool *zero, bool *commit); 22 | bool extent_in_dss(void *addr); 23 | bool extent_dss_mergeable(void *addr_a, void *addr_b); 24 | void extent_dss_boot(void); 25 | 26 | #endif /* JEMALLOC_INTERNAL_EXTENT_DSS_H */ 27 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/include/jemalloc/internal/extent_mmap.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_EXTENT_MMAP_EXTERNS_H 2 | #define JEMALLOC_INTERNAL_EXTENT_MMAP_EXTERNS_H 3 | 4 | extern bool opt_retain; 5 | 6 | void *extent_alloc_mmap(void *new_addr, size_t size, size_t alignment, 7 | bool *zero, bool *commit); 8 | bool extent_dalloc_mmap(void *addr, size_t size); 9 | 10 | #endif /* JEMALLOC_INTERNAL_EXTENT_MMAP_EXTERNS_H */ 11 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/include/jemalloc/internal/extent_types.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_EXTENT_TYPES_H 2 | #define JEMALLOC_INTERNAL_EXTENT_TYPES_H 3 | 4 | typedef struct extent_s extent_t; 5 | typedef struct extents_s extents_t; 6 | 7 | #define EXTENT_HOOKS_INITIALIZER NULL 8 | 9 | #endif /* JEMALLOC_INTERNAL_EXTENT_TYPES_H */ 10 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/include/jemalloc/internal/hooks.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_HOOKS_H 2 | #define JEMALLOC_INTERNAL_HOOKS_H 3 | 4 | extern JEMALLOC_EXPORT void (*hooks_arena_new_hook)(); 5 | extern JEMALLOC_EXPORT void (*hooks_libc_hook)(); 6 | 7 | #define JEMALLOC_HOOK(fn, hook) ((void)(hook != NULL && (hook(), 0)), fn) 8 | 9 | #define open JEMALLOC_HOOK(open, hooks_libc_hook) 10 | #define read JEMALLOC_HOOK(read, hooks_libc_hook) 11 | #define write JEMALLOC_HOOK(write, hooks_libc_hook) 12 | #define readlink JEMALLOC_HOOK(readlink, hooks_libc_hook) 13 | #define close JEMALLOC_HOOK(close, hooks_libc_hook) 14 | #define creat JEMALLOC_HOOK(creat, hooks_libc_hook) 15 | #define secure_getenv JEMALLOC_HOOK(secure_getenv, hooks_libc_hook) 16 | /* Note that this is undef'd and re-define'd in src/prof.c. */ 17 | #define _Unwind_Backtrace JEMALLOC_HOOK(_Unwind_Backtrace, hooks_libc_hook) 18 | 19 | #endif /* JEMALLOC_INTERNAL_HOOKS_H */ 20 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/include/jemalloc/internal/private_namespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for symbol in `cat "$@"` ; do 4 | echo "#define ${symbol} JEMALLOC_N(${symbol})" 5 | done 6 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/include/jemalloc/internal/public_namespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for nm in `cat $1` ; do 4 | n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'` 5 | echo "#define je_${n} JEMALLOC_N(${n})" 6 | done 7 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/include/jemalloc/internal/public_unnamespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for nm in `cat $1` ; do 4 | n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'` 5 | echo "#undef je_${n}" 6 | done 7 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/include/jemalloc/internal/spin.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_SPIN_H 2 | #define JEMALLOC_INTERNAL_SPIN_H 3 | 4 | #define SPIN_INITIALIZER {0U} 5 | 6 | typedef struct { 7 | unsigned iteration; 8 | } spin_t; 9 | 10 | static inline void 11 | spin_adaptive(spin_t *spin) { 12 | volatile uint32_t i; 13 | 14 | if (spin->iteration < 5) { 15 | for (i = 0; i < (1U << spin->iteration); i++) { 16 | CPU_SPINWAIT; 17 | } 18 | spin->iteration++; 19 | } else { 20 | #ifdef _WIN32 21 | SwitchToThread(); 22 | #else 23 | sched_yield(); 24 | #endif 25 | } 26 | } 27 | 28 | #undef SPIN_INLINE 29 | 30 | #endif /* JEMALLOC_INTERNAL_SPIN_H */ 31 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/include/jemalloc/internal/tsd_types.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_TSD_TYPES_H 2 | #define JEMALLOC_INTERNAL_TSD_TYPES_H 3 | 4 | #define MALLOC_TSD_CLEANUPS_MAX 2 5 | 6 | typedef struct tsd_s tsd_t; 7 | typedef struct tsdn_s tsdn_t; 8 | typedef bool (*malloc_tsd_cleanup_t)(void); 9 | 10 | #endif /* JEMALLOC_INTERNAL_TSD_TYPES_H */ 11 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/include/jemalloc/jemalloc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | objroot=$1 4 | 5 | cat < 5 | 6 | /* MSVC doesn't define _Bool or bool in C, but does have BOOL */ 7 | /* Note this doesn't pass autoconf's test because (bool) 0.5 != true */ 8 | /* Clang-cl uses MSVC headers, so needs msvc_compat, but has _Bool as 9 | * a built-in type. */ 10 | #ifndef __clang__ 11 | typedef BOOL _Bool; 12 | #endif 13 | 14 | #define bool _Bool 15 | #define true 1 16 | #define false 0 17 | 18 | #define __bool_true_false_are_defined 1 19 | 20 | #endif /* stdbool_h */ 21 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/include/msvc_compat/windows_extra.h: -------------------------------------------------------------------------------- 1 | #ifndef MSVC_COMPAT_WINDOWS_EXTRA_H 2 | #define MSVC_COMPAT_WINDOWS_EXTRA_H 3 | 4 | #include 5 | 6 | #endif /* MSVC_COMPAT_WINDOWS_EXTRA_H */ 7 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/jemalloc.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | install_suffix=@install_suffix@ 6 | 7 | Name: jemalloc 8 | Description: A general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support. 9 | URL: http://jemalloc.net/ 10 | Version: @jemalloc_version@ 11 | Cflags: -I${includedir} 12 | Libs: -L${libdir} -ljemalloc${install_suffix} 13 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/msvc/ReadMe.txt: -------------------------------------------------------------------------------- 1 | 2 | How to build jemalloc for Windows 3 | ================================= 4 | 5 | 1. Install Cygwin with at least the following packages: 6 | * autoconf 7 | * autogen 8 | * gawk 9 | * grep 10 | * sed 11 | 12 | 2. Install Visual Studio 2015 with Visual C++ 13 | 14 | 3. Add Cygwin\bin to the PATH environment variable 15 | 16 | 4. Open "VS2015 x86 Native Tools Command Prompt" 17 | (note: x86/x64 doesn't matter at this point) 18 | 19 | 5. Generate header files: 20 | sh -c "CC=cl ./autogen.sh" 21 | 22 | 6. Now the project can be opened and built in Visual Studio: 23 | msvc\jemalloc_vc2015.sln 24 | 25 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/msvc/projects/vc2015/test_threads/test_threads.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | int test_threads(); 4 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/msvc/projects/vc2015/test_threads/test_threads.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | 22 | 23 | Header Files 24 | 25 | 26 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/msvc/projects/vc2015/test_threads/test_threads_main.cpp: -------------------------------------------------------------------------------- 1 | #include "test_threads.h" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std::chrono_literals; 7 | 8 | int main(int argc, char** argv) { 9 | int rc = test_threads(); 10 | return rc; 11 | } 12 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/run_tests.sh: -------------------------------------------------------------------------------- 1 | $(dirname "$)")/scripts/gen_run_tests.py | bash 2 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/src/hash.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_HASH_C_ 2 | #include "jemalloc/internal/jemalloc_preamble.h" 3 | #include "jemalloc/internal/jemalloc_internal_includes.h" 4 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/src/hooks.c: -------------------------------------------------------------------------------- 1 | #include "jemalloc/internal/jemalloc_preamble.h" 2 | 3 | /* 4 | * The hooks are a little bit screwy -- they're not genuinely exported in the 5 | * sense that we want them available to end-users, but we do want them visible 6 | * from outside the generated library, so that we can use them in test code. 7 | */ 8 | JEMALLOC_EXPORT 9 | void (*hooks_arena_new_hook)() = NULL; 10 | 11 | JEMALLOC_EXPORT 12 | void (*hooks_libc_hook)() = NULL; 13 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/src/mutex_pool.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_MUTEX_POOL_C_ 2 | 3 | #include "jemalloc/internal/jemalloc_preamble.h" 4 | #include "jemalloc/internal/jemalloc_internal_includes.h" 5 | 6 | #include "jemalloc/internal/mutex.h" 7 | #include "jemalloc/internal/mutex_pool.h" 8 | 9 | bool 10 | mutex_pool_init(mutex_pool_t *pool, const char *name, witness_rank_t rank) { 11 | for (int i = 0; i < MUTEX_POOL_SIZE; ++i) { 12 | if (malloc_mutex_init(&pool->mutexes[i], name, rank, 13 | malloc_mutex_address_ordered)) { 14 | return true; 15 | } 16 | } 17 | return false; 18 | } 19 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/src/prng.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_PRNG_C_ 2 | #include "jemalloc/internal/jemalloc_preamble.h" 3 | #include "jemalloc/internal/jemalloc_internal_includes.h" 4 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/src/ticker.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_TICKER_C_ 2 | #include "jemalloc/internal/jemalloc_preamble.h" 3 | #include "jemalloc/internal/jemalloc_internal_includes.h" 4 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/include/test/btalloc.h: -------------------------------------------------------------------------------- 1 | /* btalloc() provides a mechanism for allocating via permuted backtraces. */ 2 | void *btalloc(size_t size, unsigned bits); 3 | 4 | #define btalloc_n_proto(n) \ 5 | void *btalloc_##n(size_t size, unsigned bits); 6 | btalloc_n_proto(0) 7 | btalloc_n_proto(1) 8 | 9 | #define btalloc_n_gen(n) \ 10 | void * \ 11 | btalloc_##n(size_t size, unsigned bits) { \ 12 | void *p; \ 13 | \ 14 | if (bits == 0) { \ 15 | p = mallocx(size, 0); \ 16 | } else { \ 17 | switch (bits & 0x1U) { \ 18 | case 0: \ 19 | p = (btalloc_0(size, bits >> 1)); \ 20 | break; \ 21 | case 1: \ 22 | p = (btalloc_1(size, bits >> 1)); \ 23 | break; \ 24 | default: not_reached(); \ 25 | } \ 26 | } \ 27 | /* Intentionally sabotage tail call optimization. */ \ 28 | assert_ptr_not_null(p, "Unexpected mallocx() failure"); \ 29 | return p; \ 30 | } 31 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/include/test/jemalloc_test_defs.h.in: -------------------------------------------------------------------------------- 1 | #include "jemalloc/internal/jemalloc_internal_defs.h" 2 | #include "jemalloc/internal/jemalloc_internal_decls.h" 3 | 4 | /* 5 | * For use by SFMT. configure.ac doesn't actually define HAVE_SSE2 because its 6 | * dependencies are notoriously unportable in practice. 7 | */ 8 | #undef HAVE_SSE2 9 | #undef HAVE_ALTIVEC 10 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/include/test/mtx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mtx is a slightly simplified version of malloc_mutex. This code duplication 3 | * is unfortunate, but there are allocator bootstrapping considerations that 4 | * would leak into the test infrastructure if malloc_mutex were used directly 5 | * in tests. 6 | */ 7 | 8 | typedef struct { 9 | #ifdef _WIN32 10 | CRITICAL_SECTION lock; 11 | #elif (defined(JEMALLOC_OS_UNFAIR_LOCK)) 12 | os_unfair_lock lock; 13 | #elif (defined(JEMALLOC_OSSPIN)) 14 | OSSpinLock lock; 15 | #else 16 | pthread_mutex_t lock; 17 | #endif 18 | } mtx_t; 19 | 20 | bool mtx_init(mtx_t *mtx); 21 | void mtx_fini(mtx_t *mtx); 22 | void mtx_lock(mtx_t *mtx); 23 | void mtx_unlock(mtx_t *mtx); 24 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/include/test/thd.h: -------------------------------------------------------------------------------- 1 | /* Abstraction layer for threading in tests. */ 2 | #ifdef _WIN32 3 | typedef HANDLE thd_t; 4 | #else 5 | typedef pthread_t thd_t; 6 | #endif 7 | 8 | void thd_create(thd_t *thd, void *(*proc)(void *), void *arg); 9 | void thd_join(thd_t thd, void **ret); 10 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/include/test/timer.h: -------------------------------------------------------------------------------- 1 | /* Simple timer, for use in benchmark reporting. */ 2 | 3 | typedef struct { 4 | nstime_t t0; 5 | nstime_t t1; 6 | } timedelta_t; 7 | 8 | void timer_start(timedelta_t *timer); 9 | void timer_stop(timedelta_t *timer); 10 | uint64_t timer_usec(const timedelta_t *timer); 11 | void timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen); 12 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/integration/extent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="junk:false" 5 | fi 6 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/integration/mallocx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="junk:false" 5 | fi 6 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/integration/xallocx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="junk:false" 5 | fi 6 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/src/btalloc.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | void * 4 | btalloc(size_t size, unsigned bits) { 5 | return btalloc_0(size, bits); 6 | } 7 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/src/btalloc_0.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | btalloc_n_gen(0) 4 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/src/btalloc_1.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | btalloc_n_gen(1) 4 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/src/math.c: -------------------------------------------------------------------------------- 1 | #define MATH_C_ 2 | #include "test/jemalloc_test.h" 3 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/src/mq.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | /* 4 | * Sleep for approximately ns nanoseconds. No lower *nor* upper bound on sleep 5 | * time is guaranteed. 6 | */ 7 | void 8 | mq_nanosleep(unsigned ns) { 9 | assert(ns <= 1000*1000*1000); 10 | 11 | #ifdef _WIN32 12 | Sleep(ns / 1000); 13 | #else 14 | { 15 | struct timespec timeout; 16 | 17 | if (ns < 1000*1000*1000) { 18 | timeout.tv_sec = 0; 19 | timeout.tv_nsec = ns; 20 | } else { 21 | timeout.tv_sec = 1; 22 | timeout.tv_nsec = 0; 23 | } 24 | nanosleep(&timeout, NULL); 25 | } 26 | #endif 27 | } 28 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/src/thd.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #ifdef _WIN32 4 | void 5 | thd_create(thd_t *thd, void *(*proc)(void *), void *arg) { 6 | LPTHREAD_START_ROUTINE routine = (LPTHREAD_START_ROUTINE)proc; 7 | *thd = CreateThread(NULL, 0, routine, arg, 0, NULL); 8 | if (*thd == NULL) { 9 | test_fail("Error in CreateThread()\n"); 10 | } 11 | } 12 | 13 | void 14 | thd_join(thd_t thd, void **ret) { 15 | if (WaitForSingleObject(thd, INFINITE) == WAIT_OBJECT_0 && ret) { 16 | DWORD exit_code; 17 | GetExitCodeThread(thd, (LPDWORD) &exit_code); 18 | *ret = (void *)(uintptr_t)exit_code; 19 | } 20 | } 21 | 22 | #else 23 | void 24 | thd_create(thd_t *thd, void *(*proc)(void *), void *arg) { 25 | if (pthread_create(thd, NULL, proc, arg) != 0) { 26 | test_fail("Error in pthread_create()\n"); 27 | } 28 | } 29 | 30 | void 31 | thd_join(thd_t thd, void **ret) { 32 | pthread_join(thd, ret); 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/a0.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | TEST_BEGIN(test_a0) { 4 | void *p; 5 | 6 | p = a0malloc(1); 7 | assert_ptr_not_null(p, "Unexpected a0malloc() error"); 8 | a0dalloc(p); 9 | } 10 | TEST_END 11 | 12 | int 13 | main(void) { 14 | return test_no_malloc_init( 15 | test_a0); 16 | } 17 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/arena_reset_prof.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | #define ARENA_RESET_PROF_C_ 3 | 4 | #include "arena_reset.c" 5 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/arena_reset_prof.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export MALLOC_CONF="prof:true,lg_prof_sample:0" 4 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/decay.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export MALLOC_CONF="dirty_decay_ms:1000,muzzy_decay_ms:1000,lg_tcache_max:0" 4 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/hooks.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | static bool hook_called = false; 4 | 5 | static void 6 | hook() { 7 | hook_called = true; 8 | } 9 | 10 | static int 11 | func_to_hook(int arg1, int arg2) { 12 | return arg1 + arg2; 13 | } 14 | 15 | #define func_to_hook JEMALLOC_HOOK(func_to_hook, hooks_libc_hook) 16 | 17 | TEST_BEGIN(unhooked_call) { 18 | hooks_libc_hook = NULL; 19 | hook_called = false; 20 | assert_d_eq(3, func_to_hook(1, 2), "Hooking changed return value."); 21 | assert_false(hook_called, "Nulling out hook didn't take."); 22 | } 23 | TEST_END 24 | 25 | TEST_BEGIN(hooked_call) { 26 | hooks_libc_hook = &hook; 27 | hook_called = false; 28 | assert_d_eq(3, func_to_hook(1, 2), "Hooking changed return value."); 29 | assert_true(hook_called, "Hook should have executed."); 30 | } 31 | TEST_END 32 | 33 | int 34 | main(void) { 35 | return test( 36 | unhooked_call, 37 | hooked_call); 38 | } 39 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/junk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="abort:false,zero:false,junk:true" 5 | fi 6 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/junk_alloc.c: -------------------------------------------------------------------------------- 1 | #include "junk.c" 2 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/junk_alloc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="abort:false,zero:false,junk:alloc" 5 | fi 6 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/junk_free.c: -------------------------------------------------------------------------------- 1 | #include "junk.c" 2 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/junk_free.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="abort:false,zero:false,junk:free" 5 | fi 6 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/pack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Immediately purge to minimize fragmentation. 4 | export MALLOC_CONF="dirty_decay_ms:0,muzzy_decay_ms:0" 5 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/pages.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | TEST_BEGIN(test_pages_huge) { 4 | size_t alloc_size; 5 | bool commit; 6 | void *pages, *hugepage; 7 | 8 | alloc_size = HUGEPAGE * 2 - PAGE; 9 | commit = true; 10 | pages = pages_map(NULL, alloc_size, PAGE, &commit); 11 | assert_ptr_not_null(pages, "Unexpected pages_map() error"); 12 | 13 | if (thp_state_madvise) { 14 | hugepage = (void *)(ALIGNMENT_CEILING((uintptr_t)pages, HUGEPAGE)); 15 | assert_b_ne(pages_huge(hugepage, HUGEPAGE), have_madvise_huge, 16 | "Unexpected pages_huge() result"); 17 | assert_false(pages_nohuge(hugepage, HUGEPAGE), 18 | "Unexpected pages_nohuge() result"); 19 | } 20 | 21 | pages_unmap(pages, alloc_size); 22 | } 23 | TEST_END 24 | 25 | int 26 | main(void) { 27 | return test( 28 | test_pages_huge); 29 | } 30 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/prof_accum.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0" 5 | fi 6 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/prof_active.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,prof_thread_active_init:false,lg_prof_sample:0" 5 | fi 6 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/prof_gdump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,prof_active:false,prof_gdump:true" 5 | fi 6 | 7 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/prof_idump.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | static bool did_prof_dump_open; 4 | 5 | static int 6 | prof_dump_open_intercept(bool propagate_err, const char *filename) { 7 | int fd; 8 | 9 | did_prof_dump_open = true; 10 | 11 | fd = open("/dev/null", O_WRONLY); 12 | assert_d_ne(fd, -1, "Unexpected open() failure"); 13 | 14 | return fd; 15 | } 16 | 17 | TEST_BEGIN(test_idump) { 18 | bool active; 19 | void *p; 20 | 21 | test_skip_if(!config_prof); 22 | 23 | active = true; 24 | assert_d_eq(mallctl("prof.active", NULL, NULL, (void *)&active, 25 | sizeof(active)), 0, 26 | "Unexpected mallctl failure while activating profiling"); 27 | 28 | prof_dump_open = prof_dump_open_intercept; 29 | 30 | did_prof_dump_open = false; 31 | p = mallocx(1, 0); 32 | assert_ptr_not_null(p, "Unexpected mallocx() failure"); 33 | dallocx(p, 0); 34 | assert_true(did_prof_dump_open, "Expected a profile dump"); 35 | } 36 | TEST_END 37 | 38 | int 39 | main(void) { 40 | return test( 41 | test_idump); 42 | } 43 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/prof_idump.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export MALLOC_CONF="tcache:false" 4 | if [ "x${enable_prof}" = "x1" ] ; then 5 | export MALLOC_CONF="${MALLOC_CONF},prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0,lg_prof_interval:0" 6 | fi 7 | 8 | 9 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/prof_reset.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,prof_active:false,lg_prof_sample:0" 5 | fi 6 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/prof_tctx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,lg_prof_sample:0" 5 | fi 6 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/prof_thread_name.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_prof}" = "x1" ] ; then 4 | export MALLOC_CONF="prof:true,prof_active:false" 5 | fi 6 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/slab.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | TEST_BEGIN(test_arena_slab_regind) { 4 | szind_t binind; 5 | 6 | for (binind = 0; binind < NBINS; binind++) { 7 | size_t regind; 8 | extent_t slab; 9 | const arena_bin_info_t *bin_info = &arena_bin_info[binind]; 10 | extent_init(&slab, NULL, mallocx(bin_info->slab_size, 11 | MALLOCX_LG_ALIGN(LG_PAGE)), bin_info->slab_size, true, 12 | binind, 0, extent_state_active, false, true); 13 | assert_ptr_not_null(extent_addr_get(&slab), 14 | "Unexpected malloc() failure"); 15 | for (regind = 0; regind < bin_info->nregs; regind++) { 16 | void *reg = (void *)((uintptr_t)extent_addr_get(&slab) + 17 | (bin_info->reg_size * regind)); 18 | assert_zu_eq(arena_slab_regind(&slab, binind, reg), 19 | regind, 20 | "Incorrect region index computed for size %zu", 21 | bin_info->reg_size); 22 | } 23 | free(extent_addr_get(&slab)); 24 | } 25 | } 26 | TEST_END 27 | 28 | int 29 | main(void) { 30 | return test( 31 | test_arena_slab_regind); 32 | } 33 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/spin.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #include "jemalloc/internal/spin.h" 4 | 5 | TEST_BEGIN(test_spin) { 6 | spin_t spinner = SPIN_INITIALIZER; 7 | 8 | for (unsigned i = 0; i < 100; i++) { 9 | spin_adaptive(&spinner); 10 | } 11 | } 12 | TEST_END 13 | 14 | int 15 | main(void) { 16 | return test( 17 | test_spin); 18 | } 19 | -------------------------------------------------------------------------------- /depends/skynet/3rd/jemalloc/test/unit/zero.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "x${enable_fill}" = "x1" ] ; then 4 | export MALLOC_CONF="abort:false,junk:false,zero:true" 5 | fi 6 | -------------------------------------------------------------------------------- /depends/skynet/3rd/lpeg/lpcode.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lpcode.h,v 1.7 2015/06/12 18:24:45 roberto Exp $ 3 | */ 4 | 5 | #if !defined(lpcode_h) 6 | #define lpcode_h 7 | 8 | #include "lua.h" 9 | 10 | #include "lptypes.h" 11 | #include "lptree.h" 12 | #include "lpvm.h" 13 | 14 | int tocharset (TTree *tree, Charset *cs); 15 | int checkaux (TTree *tree, int pred); 16 | int fixedlenx (TTree *tree, int count, int len); 17 | int hascaptures (TTree *tree); 18 | int lp_gc (lua_State *L); 19 | Instruction *compile (lua_State *L, Pattern *p); 20 | void realloccode (lua_State *L, Pattern *p, int nsize); 21 | int sizei (const Instruction *i); 22 | 23 | 24 | #define PEnullable 0 25 | #define PEnofail 1 26 | 27 | /* 28 | ** nofail(t) implies that 't' cannot fail with any input 29 | */ 30 | #define nofail(t) checkaux(t, PEnofail) 31 | 32 | /* 33 | ** (not nullable(t)) implies 't' cannot match without consuming 34 | ** something 35 | */ 36 | #define nullable(t) checkaux(t, PEnullable) 37 | 38 | #define fixedlen(t) fixedlenx(t, 0, 0) 39 | 40 | 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /depends/skynet/3rd/lpeg/lpeg-128.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lpeg/lpeg-128.gif -------------------------------------------------------------------------------- /depends/skynet/3rd/lpeg/lpprint.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lpprint.h,v 1.2 2015/06/12 18:18:08 roberto Exp $ 3 | */ 4 | 5 | 6 | #if !defined(lpprint_h) 7 | #define lpprint_h 8 | 9 | 10 | #include "lptree.h" 11 | #include "lpvm.h" 12 | 13 | 14 | #if defined(LPEG_DEBUG) 15 | 16 | void printpatt (Instruction *p, int n); 17 | void printtree (TTree *tree, int ident); 18 | void printktable (lua_State *L, int idx); 19 | void printcharset (const byte *st); 20 | void printcaplist (Capture *cap, Capture *limit); 21 | void printinst (const Instruction *op, const Instruction *p); 22 | 23 | #else 24 | 25 | #define printktable(L,idx) \ 26 | luaL_error(L, "function only implemented in debug mode") 27 | #define printtree(tree,i) \ 28 | luaL_error(L, "function only implemented in debug mode") 29 | #define printpatt(p,n) \ 30 | luaL_error(L, "function only implemented in debug mode") 31 | 32 | #endif 33 | 34 | 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /depends/skynet/3rd/lua-md5/README: -------------------------------------------------------------------------------- 1 | MD5 - Cryptographic Library for Lua 2 | Copyright 2003 PUC-Rio 3 | http://www.keplerproject.org/md5 4 | 5 | MD5 offers basic cryptographic facilities for Lua 5.1: a hash (digest) 6 | function, a pair crypt/decrypt based on MD5 and CFB, and a pair crypt/decrypt based 7 | on DES with 56-bit keys. 8 | 9 | MD5 current version is 1.1.2. 10 | 11 | This version is copy from https://github.com/keplerproject/md5 12 | 13 | -------------------------------------------------------------------------------- /depends/skynet/3rd/lua-md5/compat-5.2.c: -------------------------------------------------------------------------------- 1 | #include "lua.h" 2 | #include "lauxlib.h" 3 | #include "compat-5.2.h" 4 | 5 | #if !defined LUA_VERSION_NUM || LUA_VERSION_NUM==501 6 | /* 7 | ** Adapted from Lua 5.2.0 8 | */ 9 | void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) { 10 | luaL_checkstack(L, nup+1, "too many upvalues"); 11 | for (; l->name != NULL; l++) { /* fill the table with given functions */ 12 | int i; 13 | lua_pushstring(L, l->name); 14 | for (i = 0; i < nup; i++) /* copy upvalues to the top */ 15 | lua_pushvalue(L, -(nup + 1)); 16 | lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */ 17 | lua_settable(L, -(nup + 3)); /* table must be below the upvalues, the name and the closure */ 18 | } 19 | lua_pop(L, nup); /* remove upvalues */ 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /depends/skynet/3rd/lua-md5/compat-5.2.h: -------------------------------------------------------------------------------- 1 | #if !defined LUA_VERSION_NUM 2 | /* Lua 5.0 */ 3 | #define luaL_Reg luaL_reg 4 | 5 | #define luaL_addchar(B,c) \ 6 | ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ 7 | (*(B)->p++ = (char)(c))) 8 | #endif 9 | 10 | #if LUA_VERSION_NUM==501 11 | /* Lua 5.1 */ 12 | #define lua_rawlen lua_objlen 13 | #endif 14 | 15 | void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup); 16 | -------------------------------------------------------------------------------- /depends/skynet/3rd/lua-md5/md5.h: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: md5.h,v 1.2 2006/03/03 15:04:49 tomas Exp $ 3 | * Cryptographic module for Lua. 4 | * @author Roberto Ierusalimschy 5 | */ 6 | 7 | 8 | #ifndef md5_h 9 | #define md5_h 10 | 11 | #include 12 | 13 | 14 | #define HASHSIZE 16 15 | 16 | void md5 (const char *message, long len, char *output); 17 | int luaopen_md5_core (lua_State *L); 18 | 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/README: -------------------------------------------------------------------------------- 1 | This is a modify version of lua 5.3.2 (http://www.lua.org/ftp/lua-5.3.2.tar.gz) . 2 | 3 | For detail , 4 | Shared Proto : http://lua-users.org/lists/lua-l/2014-03/msg00489.html 5 | Shared short string table : http://blog.codingnow.com/2015/08/lua_vm_share_string.html 6 | Signal for debug use : http://blog.codingnow.com/2015/03/skynet_signal.html 7 | -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lapi.h,v 2.9 2015/03/06 19:49:50 roberto Exp $ 3 | ** Auxiliary functions from Lua API 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lapi_h 8 | #define lapi_h 9 | 10 | 11 | #include "llimits.h" 12 | #include "lstate.h" 13 | 14 | #define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \ 15 | "stack overflow");} 16 | 17 | #define adjustresults(L,nres) \ 18 | { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } 19 | 20 | #define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ 21 | "not enough elements in the stack") 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lapi.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lapi.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lauxlib.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lauxlib.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lbaselib.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lbaselib.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lbitlib.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lbitlib.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lcode.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lcode.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lcorolib.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lcorolib.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lctype.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lctype.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/ldblib.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/ldblib.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/ldebug.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/ldebug.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/ldo.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/ldo.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/ldump.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/ldump.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lfunc.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lfunc.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lgc.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lgc.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/liblua.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/liblua.a -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/linit.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/linit.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/liolib.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/liolib.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/llex.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/llex.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lmathlib.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lmathlib.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lmem.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lmem.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/loadlib.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/loadlib.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lobject.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lobject.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lopcodes.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lopcodes.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/loslib.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/loslib.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lparser.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lparser.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lprefix.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp $ 3 | ** Definitions for Lua code that must come before any other header file 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lprefix_h 8 | #define lprefix_h 9 | 10 | 11 | /* 12 | ** Allows POSIX/XSI stuff 13 | */ 14 | #if !defined(LUA_USE_C89) /* { */ 15 | 16 | #if !defined(_XOPEN_SOURCE) 17 | #define _XOPEN_SOURCE 600 18 | #elif _XOPEN_SOURCE == 0 19 | #undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ 20 | #endif 21 | 22 | /* 23 | ** Allows manipulation of large files in gcc and some other compilers 24 | */ 25 | #if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS) 26 | #define _LARGEFILE_SOURCE 1 27 | #define _FILE_OFFSET_BITS 64 28 | #endif 29 | 30 | #endif /* } */ 31 | 32 | 33 | /* 34 | ** Windows stuff 35 | */ 36 | #if defined(_WIN32) /* { */ 37 | 38 | #if !defined(_CRT_SECURE_NO_WARNINGS) 39 | #define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ 40 | #endif 41 | 42 | #endif /* } */ 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lstate.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lstate.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lstring.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lstring.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lstrlib.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lstrlib.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/ltable.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/ltable.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/ltablib.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/ltablib.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/ltm.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/ltm.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lua -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lua.hpp: -------------------------------------------------------------------------------- 1 | // lua.hpp 2 | // Lua header files for C++ 3 | // <> not supplied automatically because Lua also compiles as C++ 4 | 5 | extern "C" { 6 | #include "lua.h" 7 | #include "lualib.h" 8 | #include "lauxlib.h" 9 | } 10 | -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lua.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lua.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/luac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/luac -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/luac.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/luac.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h,v 1.45 2015/09/08 15:41:05 roberto Exp $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "llimits.h" 11 | #include "lobject.h" 12 | #include "lzio.h" 13 | 14 | 15 | /* data to catch conversion errors */ 16 | #define LUAC_DATA "\x19\x93\r\n\x1a\n" 17 | 18 | #define LUAC_INT 0x5678 19 | #define LUAC_NUM cast_num(370.5) 20 | 21 | #define MYINT(s) (s[0]-'0') 22 | #define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)) 23 | #define LUAC_FORMAT 0 /* this is the official format */ 24 | 25 | /* load one chunk; from lundump.c */ 26 | LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name); 27 | 28 | /* dump one chunk; from ldump.c */ 29 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, 30 | void* data, int strip); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lundump.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lundump.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lutf8lib.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lutf8lib.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lvm.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lvm.o -------------------------------------------------------------------------------- /depends/skynet/3rd/lua/lzio.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/3rd/lua/lzio.o -------------------------------------------------------------------------------- /depends/skynet/cservice/gate.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/cservice/gate.so -------------------------------------------------------------------------------- /depends/skynet/cservice/harbor.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/cservice/harbor.so -------------------------------------------------------------------------------- /depends/skynet/cservice/logger.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/cservice/logger.so -------------------------------------------------------------------------------- /depends/skynet/cservice/snlua.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/cservice/snlua.so -------------------------------------------------------------------------------- /depends/skynet/examples/abort.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | require "skynet.manager" -- import skynet.abort 3 | 4 | skynet.abort() 5 | -------------------------------------------------------------------------------- /depends/skynet/examples/checkdeadloop.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | 3 | local list = {} 4 | 5 | local function timeout_check(ti) 6 | if not next(list) then 7 | return 8 | end 9 | skynet.sleep(ti) -- sleep 10 sec 10 | for k,v in pairs(list) do 11 | skynet.error("timout",ti,k,v) 12 | end 13 | end 14 | 15 | skynet.start(function() 16 | skynet.error("ping all") 17 | local list_ret = skynet.call(".launcher", "lua", "LIST") 18 | for addr, desc in pairs(list_ret) do 19 | list[addr] = desc 20 | skynet.fork(function() 21 | skynet.call(addr,"debug","INFO") 22 | list[addr] = nil 23 | end) 24 | end 25 | skynet.sleep(0) 26 | timeout_check(100) 27 | timeout_check(400) 28 | timeout_check(500) 29 | skynet.exit() 30 | end) 31 | -------------------------------------------------------------------------------- /depends/skynet/examples/cluster1.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local cluster = require "cluster" 3 | local snax = require "snax" 4 | 5 | skynet.start(function() 6 | local sdb = skynet.newservice("simpledb") 7 | -- register name "sdb" for simpledb, you can use cluster.query() later. 8 | -- See cluster2.lua 9 | cluster.register("sdb", sdb) 10 | 11 | print(skynet.call(sdb, "lua", "SET", "a", "foobar")) 12 | print(skynet.call(sdb, "lua", "SET", "b", "foobar2")) 13 | print(skynet.call(sdb, "lua", "GET", "a")) 14 | print(skynet.call(sdb, "lua", "GET", "b")) 15 | cluster.open "db" 16 | cluster.open "db2" 17 | -- unique snax service 18 | snax.uniqueservice "pingserver" 19 | end) 20 | -------------------------------------------------------------------------------- /depends/skynet/examples/cluster2.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local cluster = require "cluster" 3 | 4 | skynet.start(function() 5 | -- query name "sdb" of cluster db. 6 | local sdb = cluster.query("db", "sdb") 7 | print("db.sbd=",sdb) 8 | local proxy = cluster.proxy("db", sdb) 9 | local largekey = string.rep("X", 128*1024) 10 | local largevalue = string.rep("R", 100 * 1024) 11 | print(skynet.call(proxy, "lua", "SET", largekey, largevalue)) 12 | local v = skynet.call(proxy, "lua", "GET", largekey) 13 | assert(largevalue == v) 14 | 15 | print(cluster.call("db", sdb, "GET", "a")) 16 | print(cluster.call("db2", sdb, "GET", "b")) 17 | 18 | -- test snax service 19 | local pingserver = cluster.snax("db", "pingserver") 20 | print(pingserver.req.ping "hello") 21 | end) 22 | -------------------------------------------------------------------------------- /depends/skynet/examples/clustername.lua: -------------------------------------------------------------------------------- 1 | db = "127.0.0.1:2528" 2 | db2 = "127.0.0.1:2529" 3 | -------------------------------------------------------------------------------- /depends/skynet/examples/config: -------------------------------------------------------------------------------- 1 | root = "./" 2 | thread = 8 3 | logger = nil 4 | logpath = "." 5 | harbor = 1 6 | address = "127.0.0.1:2526" 7 | master = "127.0.0.1:2013" 8 | start = "main" -- main script 9 | bootstrap = "snlua bootstrap" -- The service for bootstrap 10 | standalone = "0.0.0.0:2013" 11 | luaservice = root.."service/?.lua;"..root.."test/?.lua;"..root.."examples/?.lua" 12 | lualoader = root .. "lualib/loader.lua" 13 | lua_path = root.."lualib/?.lua;"..root.."lualib/?/init.lua" 14 | lua_cpath = root .. "luaclib/?.so" 15 | -- preload = "./examples/preload.lua" -- run preload.lua before every lua service run 16 | snax = root.."examples/?.lua;"..root.."test/?.lua" 17 | -- snax_interface_g = "snax_g" 18 | cpath = root.."cservice/?.so" 19 | -- daemon = "./skynet.pid" 20 | -------------------------------------------------------------------------------- /depends/skynet/examples/config.c1: -------------------------------------------------------------------------------- 1 | thread = 8 2 | logger = nil 3 | harbor = 0 4 | start = "cluster1" 5 | bootstrap = "snlua bootstrap" -- The service for bootstrap 6 | luaservice = "./service/?.lua;./test/?.lua;./examples/?.lua" 7 | lualoader = "lualib/loader.lua" 8 | cpath = "./cservice/?.so" 9 | cluster = "./examples/clustername.lua" 10 | snax = "./test/?.lua" 11 | -------------------------------------------------------------------------------- /depends/skynet/examples/config.c2: -------------------------------------------------------------------------------- 1 | thread = 8 2 | logger = nil 3 | harbor = 0 4 | start = "cluster2" 5 | bootstrap = "snlua bootstrap" -- The service for bootstrap 6 | luaservice = "./service/?.lua;./test/?.lua;./examples/?.lua" 7 | lualoader = "lualib/loader.lua" 8 | cpath = "./cservice/?.so" 9 | cluster = "./examples/clustername.lua" 10 | snax = "./test/?.lua" 11 | -------------------------------------------------------------------------------- /depends/skynet/examples/config.login: -------------------------------------------------------------------------------- 1 | thread = 8 2 | logger = nil 3 | harbor = 0 4 | start = "main" 5 | bootstrap = "snlua bootstrap" -- The service for bootstrap 6 | luaservice = "./service/?.lua;./examples/login/?.lua" 7 | lualoader = "lualib/loader.lua" 8 | cpath = "./cservice/?.so" 9 | -------------------------------------------------------------------------------- /depends/skynet/examples/config.mc: -------------------------------------------------------------------------------- 1 | root = "./" 2 | thread = 8 3 | logger = nil 4 | harbor = 2 5 | address = "127.0.0.1:2527" 6 | master = "127.0.0.1:2013" 7 | start = "testmulticast2" -- main script 8 | bootstrap = "snlua bootstrap" -- The service for bootstrap 9 | --standalone = "0.0.0.0:2013" 10 | luaservice = root.."service/?.lua;"..root.."test/?.lua;"..root.."examples/?.lua" 11 | lualoader = "lualib/loader.lua" 12 | -- preload = "./examples/preload.lua" -- run preload.lua before every lua service run 13 | snax = root.."examples/?.lua;"..root.."test/?.lua" 14 | cpath = root.."cservice/?.so" 15 | -------------------------------------------------------------------------------- /depends/skynet/examples/config.mysql: -------------------------------------------------------------------------------- 1 | root = "./" 2 | thread = 8 3 | logger = nil 4 | harbor = 0 5 | start = "main_mysql" -- main script 6 | bootstrap = "snlua bootstrap" -- The service for bootstrap 7 | luaservice = root.."service/?.lua;"..root.."test/?.lua;"..root.."examples/?.lua" 8 | lualoader = "lualib/loader.lua" 9 | snax = root.."examples/?.lua;"..root.."test/?.lua" 10 | cpath = root.."cservice/?.so" 11 | -- daemon = "./skynet.pid" 12 | -------------------------------------------------------------------------------- /depends/skynet/examples/config.userlog: -------------------------------------------------------------------------------- 1 | root = "./" 2 | thread = 8 3 | logger = "userlog" 4 | logservice = "snlua" 5 | logpath = "." 6 | harbor = 0 7 | start = "main" -- main script 8 | bootstrap = "snlua bootstrap" -- The service for bootstrap 9 | luaservice = root.."service/?.lua;"..root.."test/?.lua;"..root.."examples/?.lua" 10 | lualoader = "lualib/loader.lua" 11 | -- preload = "./examples/preload.lua" -- run preload.lua before every lua service run 12 | snax = root.."examples/?.lua;"..root.."test/?.lua" 13 | -- snax_interface_g = "snax_g" 14 | cpath = root.."cservice/?.so" 15 | -- daemon = "./skynet.pid" 16 | -------------------------------------------------------------------------------- /depends/skynet/examples/config_log: -------------------------------------------------------------------------------- 1 | thread = 8 2 | mqueue = 256 3 | cpath = "./cservice/?.so" 4 | logger = nil 5 | harbor = 2 6 | address = "127.0.0.1:2527" 7 | master = "127.0.0.1:2013" 8 | start = "main_log" 9 | luaservice ="./service/?.lua;./test/?.lua;./examples/?.lua" 10 | snax = "./examples/?.lua;./test/?.lua" 11 | -------------------------------------------------------------------------------- /depends/skynet/examples/globallog.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | require "skynet.manager" -- import skynet.register 3 | 4 | skynet.start(function() 5 | skynet.dispatch("lua", function(session, address, ...) 6 | print("[GLOBALLOG]", skynet.address(address), ...) 7 | end) 8 | skynet.register ".log" 9 | skynet.register "LOG" 10 | end) 11 | -------------------------------------------------------------------------------- /depends/skynet/examples/injectlaunch.lua: -------------------------------------------------------------------------------- 1 | if not _P then 2 | print[[ 3 | This file is examples to show how to inject code into lua service. 4 | It is used to inject into launcher service to change the command.LAUNCH to command.LOGLAUNCH. 5 | telnet the debug_console service (nc 127.0.0.1 8000), and run: 6 | inject 3 examples/injectlaunch.lua -- 3 means launcher service 7 | ]] 8 | return 9 | end 10 | local command = _P.lua.command 11 | 12 | if command.RAWLAUNCH then 13 | command.LAUNCH, command.RAWLAUNCH = command.RAWLAUNCH 14 | print "restore command.LAUNCH" 15 | else 16 | command.RAWLAUNCH = command.LAUNCH 17 | command.LAUNCH = command.LOGLAUNCH 18 | print "replace command.LAUNCH" 19 | end 20 | -------------------------------------------------------------------------------- /depends/skynet/examples/login/main.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | 3 | skynet.start(function() 4 | local loginserver = skynet.newservice("logind") 5 | local gate = skynet.newservice("gated", loginserver) 6 | 7 | skynet.call(gate, "lua", "open" , { 8 | port = 8888, 9 | maxclient = 64, 10 | servername = "sample", 11 | }) 12 | end) 13 | -------------------------------------------------------------------------------- /depends/skynet/examples/main.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local sprotoloader = require "sprotoloader" 3 | 4 | local max_client = 64 5 | 6 | skynet.start(function() 7 | skynet.error("Server start") 8 | skynet.uniqueservice("protoloader") 9 | if not skynet.getenv "daemon" then 10 | local console = skynet.newservice("console") 11 | end 12 | skynet.newservice("debug_console",8000) 13 | skynet.newservice("simpledb") 14 | local watchdog = skynet.newservice("watchdog") 15 | skynet.call(watchdog, "lua", "start", { 16 | port = 8888, 17 | maxclient = max_client, 18 | nodelay = true, 19 | }) 20 | skynet.error("Watchdog listen on", 8888) 21 | skynet.exit() 22 | end) 23 | -------------------------------------------------------------------------------- /depends/skynet/examples/main_log.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local harbor = require "skynet.harbor" 3 | require "skynet.manager" -- import skynet.monitor 4 | 5 | local function monitor_master() 6 | harbor.linkmaster() 7 | print("master is down") 8 | skynet.exit() 9 | end 10 | 11 | skynet.start(function() 12 | print("Log server start") 13 | skynet.monitor "simplemonitor" 14 | local log = skynet.newservice("globallog") 15 | skynet.fork(monitor_master) 16 | end) 17 | 18 | -------------------------------------------------------------------------------- /depends/skynet/examples/main_mysql.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | 3 | 4 | skynet.start(function() 5 | print("Main Server start") 6 | local console = skynet.newservice("testmysql") 7 | 8 | print("Main Server exit") 9 | skynet.exit() 10 | end) 11 | -------------------------------------------------------------------------------- /depends/skynet/examples/preload.lua: -------------------------------------------------------------------------------- 1 | -- This file will execute before every lua service start 2 | -- See config 3 | 4 | print("PRELOAD", ...) 5 | 6 | -------------------------------------------------------------------------------- /depends/skynet/examples/proto.lua: -------------------------------------------------------------------------------- 1 | local sprotoparser = require "sprotoparser" 2 | 3 | local proto = {} 4 | 5 | proto.c2s = sprotoparser.parse [[ 6 | .package { 7 | type 0 : integer 8 | session 1 : integer 9 | } 10 | 11 | handshake 1 { 12 | response { 13 | msg 0 : string 14 | } 15 | } 16 | 17 | get 2 { 18 | request { 19 | what 0 : string 20 | } 21 | response { 22 | result 0 : string 23 | } 24 | } 25 | 26 | set 3 { 27 | request { 28 | what 0 : string 29 | value 1 : string 30 | } 31 | } 32 | 33 | quit 4 {} 34 | 35 | ]] 36 | 37 | proto.s2c = sprotoparser.parse [[ 38 | .package { 39 | type 0 : integer 40 | session 1 : integer 41 | } 42 | 43 | heartbeat 1 {} 44 | ]] 45 | 46 | return proto 47 | -------------------------------------------------------------------------------- /depends/skynet/examples/protoloader.lua: -------------------------------------------------------------------------------- 1 | -- module proto as examples/proto.lua 2 | package.path = "./examples/?.lua;" .. package.path 3 | 4 | local skynet = require "skynet" 5 | local sprotoparser = require "sprotoparser" 6 | local sprotoloader = require "sprotoloader" 7 | local proto = require "proto" 8 | 9 | skynet.start(function() 10 | sprotoloader.save(proto.c2s, 1) 11 | sprotoloader.save(proto.s2c, 2) 12 | -- don't call skynet.exit() , because sproto.core may unload and the global slot become invalid 13 | end) 14 | -------------------------------------------------------------------------------- /depends/skynet/examples/simpledb.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | require "skynet.manager" -- import skynet.register 3 | local db = {} 4 | 5 | local command = {} 6 | 7 | function command.GET(key) 8 | return db[key] 9 | end 10 | 11 | function command.SET(key, value) 12 | local last = db[key] 13 | db[key] = value 14 | return last 15 | end 16 | 17 | skynet.start(function() 18 | skynet.dispatch("lua", function(session, address, cmd, ...) 19 | local f = command[string.upper(cmd)] 20 | if f then 21 | skynet.ret(skynet.pack(f(...))) 22 | else 23 | error(string.format("Unknown command %s", tostring(cmd))) 24 | end 25 | end) 26 | skynet.register "SIMPLEDB" 27 | end) 28 | -------------------------------------------------------------------------------- /depends/skynet/examples/simplemonitor.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | 3 | -- It's a simple service exit monitor, you can do something more when a service exit. 4 | 5 | local service_map = {} 6 | 7 | skynet.register_protocol { 8 | name = "client", 9 | id = skynet.PTYPE_CLIENT, -- PTYPE_CLIENT = 3 10 | unpack = function() end, 11 | dispatch = function(_, address) 12 | local w = service_map[address] 13 | if w then 14 | for watcher in pairs(w) do 15 | skynet.redirect(watcher, address, "error", 0, "") 16 | end 17 | service_map[address] = false 18 | end 19 | end 20 | } 21 | 22 | local function monitor(session, watcher, command, service) 23 | assert(command, "WATCH") 24 | local w = service_map[service] 25 | if not w then 26 | if w == false then 27 | skynet.ret(skynet.pack(false)) 28 | return 29 | end 30 | w = {} 31 | service_map[service] = w 32 | end 33 | w[watcher] = true 34 | skynet.ret(skynet.pack(true)) 35 | end 36 | 37 | skynet.start(function() 38 | skynet.dispatch("lua", monitor) 39 | end) 40 | -------------------------------------------------------------------------------- /depends/skynet/examples/userlog.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | require "skynet.manager" 3 | 4 | skynet.register_protocol { 5 | name = "text", 6 | id = skynet.PTYPE_TEXT, 7 | unpack = skynet.tostring, 8 | dispatch = function(_, address, msg) 9 | print(string.format(":%08x(%.2f): %s", address, skynet.time(), msg)) 10 | end 11 | } 12 | 13 | skynet.register_protocol { 14 | name = "SYSTEM", 15 | id = skynet.PTYPE_SYSTEM, 16 | unpack = function(...) return ... end, 17 | dispatch = function() 18 | -- reopen signal 19 | print("SIGHUP") 20 | end 21 | } 22 | 23 | skynet.start(function() 24 | skynet.register ".logger" 25 | end) -------------------------------------------------------------------------------- /depends/skynet/luaclib/bson.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/bson.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/clientsocket.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/clientsocket.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/clientwebsocket.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/clientwebsocket.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/cluster.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/cluster.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/crab.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/crab.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/crypt.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/crypt.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/debugchannel.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/debugchannel.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/lpeg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/lpeg.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/ltime.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/ltime.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/md5.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/md5.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/memory.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/memory.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/mongo.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/mongo.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/multicast.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/multicast.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/mysqlaux.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/mysqlaux.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/netpack.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/netpack.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/profile.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/profile.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/sharedata.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/sharedata.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/skynet.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/skynet.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/socketdriver.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/socketdriver.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/sproto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/sproto.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/stm.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/stm.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/utf8.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/utf8.so -------------------------------------------------------------------------------- /depends/skynet/luaclib/websocketnetpack.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/luaclib/websocketnetpack.so -------------------------------------------------------------------------------- /depends/skynet/lualib-src/lua-seri.h: -------------------------------------------------------------------------------- 1 | #ifndef LUA_SERIALIZE_H 2 | #define LUA_SERIALIZE_H 3 | 4 | #include 5 | 6 | int luaseri_pack(lua_State *L); 7 | int luaseri_unpack(lua_State *L); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /depends/skynet/lualib-src/sproto/README: -------------------------------------------------------------------------------- 1 | Check https://github.com/cloudwu/sproto for more 2 | -------------------------------------------------------------------------------- /depends/skynet/lualib-src/sproto/msvcint.h: -------------------------------------------------------------------------------- 1 | #ifndef msvc_int_h 2 | #define msvc_int_h 3 | 4 | #ifdef _MSC_VER 5 | # define inline __inline 6 | # ifndef _MSC_STDINT_H_ 7 | # if (_MSC_VER < 1300) 8 | typedef signed char int8_t; 9 | typedef signed short int16_t; 10 | typedef signed int int32_t; 11 | typedef unsigned char uint8_t; 12 | typedef unsigned short uint16_t; 13 | typedef unsigned int uint32_t; 14 | # else 15 | typedef signed __int8 int8_t; 16 | typedef signed __int16 int16_t; 17 | typedef signed __int32 int32_t; 18 | typedef unsigned __int8 uint8_t; 19 | typedef unsigned __int16 uint16_t; 20 | typedef unsigned __int32 uint32_t; 21 | # endif 22 | typedef signed __int64 int64_t; 23 | typedef unsigned __int64 uint64_t; 24 | # endif 25 | 26 | #else 27 | 28 | #include 29 | 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /depends/skynet/lualib/datacenter.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | 3 | local datacenter = {} 4 | 5 | function datacenter.get(...) 6 | return skynet.call("DATACENTER", "lua", "QUERY", ...) 7 | end 8 | 9 | function datacenter.set(...) 10 | return skynet.call("DATACENTER", "lua", "UPDATE", ...) 11 | end 12 | 13 | function datacenter.wait(...) 14 | return skynet.call("DATACENTER", "lua", "WAIT", ...) 15 | end 16 | 17 | return datacenter 18 | 19 | -------------------------------------------------------------------------------- /depends/skynet/lualib/http/url.lua: -------------------------------------------------------------------------------- 1 | local url = {} 2 | 3 | local function decode_func(c) 4 | return string.char(tonumber(c, 16)) 5 | end 6 | 7 | local function decode(str) 8 | local str = str:gsub('+', ' ') 9 | return str:gsub("%%(..)", decode_func) 10 | end 11 | 12 | function url.parse(u) 13 | local path,query = u:match "([^?]*)%??(.*)" 14 | if path then 15 | path = decode(path) 16 | end 17 | return path, query 18 | end 19 | 20 | function url.parse_query(q) 21 | local r = {} 22 | for k,v in q:gmatch "(.-)=([^&]*)&?" do 23 | r[decode(k)] = decode(v) 24 | end 25 | return r 26 | end 27 | 28 | return url 29 | -------------------------------------------------------------------------------- /depends/skynet/lualib/skynet/harbor.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | 3 | local harbor = {} 4 | 5 | function harbor.globalname(name, handle) 6 | handle = handle or skynet.self() 7 | skynet.send(".cslave", "lua", "REGISTER", name, handle) 8 | end 9 | 10 | function harbor.queryname(name) 11 | return skynet.call(".cslave", "lua", "QUERYNAME", name) 12 | end 13 | 14 | function harbor.link(id) 15 | skynet.call(".cslave", "lua", "LINK", id) 16 | end 17 | 18 | function harbor.connect(id) 19 | skynet.call(".cslave", "lua", "CONNECT", id) 20 | end 21 | 22 | function harbor.linkmaster() 23 | skynet.call(".cslave", "lua", "LINKMASTER") 24 | end 25 | 26 | return harbor 27 | -------------------------------------------------------------------------------- /depends/skynet/lualib/skynet/queue.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local coroutine = coroutine 3 | local xpcall = xpcall 4 | local traceback = debug.traceback 5 | local table = table 6 | 7 | function skynet.queue() 8 | local current_thread 9 | local ref = 0 10 | local thread_queue = {} 11 | 12 | local function xpcall_ret(ok, ...) 13 | ref = ref - 1 14 | if ref == 0 then 15 | current_thread = table.remove(thread_queue,1) 16 | if current_thread then 17 | skynet.wakeup(current_thread) 18 | end 19 | end 20 | assert(ok, (...)) 21 | return ... 22 | end 23 | 24 | return function(f, ...) 25 | local thread = coroutine.running() 26 | if current_thread and current_thread ~= thread then 27 | table.insert(thread_queue, thread) 28 | skynet.wait() 29 | assert(ref == 0) -- current_thread == thread 30 | end 31 | current_thread = thread 32 | 33 | ref = ref + 1 34 | return xpcall_ret(xpcall(f, traceback, ...)) 35 | end 36 | end 37 | 38 | return skynet.queue 39 | -------------------------------------------------------------------------------- /depends/skynet/lualib/sprotoloader.lua: -------------------------------------------------------------------------------- 1 | local parser = require "sprotoparser" 2 | local core = require "sproto.core" 3 | local sproto = require "sproto" 4 | 5 | local loader = {} 6 | 7 | function loader.register(filename, index) 8 | local f = assert(io.open(filename), "Can't open sproto file") 9 | local data = f:read "a" 10 | f:close() 11 | local sp = core.newproto(parser.parse(data)) 12 | core.saveproto(sp, index) 13 | end 14 | 15 | function loader.save(bin, index) 16 | local sp = core.newproto(bin) 17 | core.saveproto(sp, index) 18 | end 19 | 20 | function loader.load(index) 21 | local sp = core.loadproto(index) 22 | -- no __gc in metatable 23 | return sproto.sharenew(sp) 24 | end 25 | 26 | return loader 27 | 28 | -------------------------------------------------------------------------------- /depends/skynet/service/clusterproxy.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local cluster = require "cluster" 3 | require "skynet.manager" -- inject skynet.forward_type 4 | 5 | local node, address = ... 6 | 7 | skynet.register_protocol { 8 | name = "system", 9 | id = skynet.PTYPE_SYSTEM, 10 | unpack = function (...) return ... end, 11 | } 12 | 13 | local forward_map = { 14 | [skynet.PTYPE_SNAX] = skynet.PTYPE_SYSTEM, 15 | [skynet.PTYPE_LUA] = skynet.PTYPE_SYSTEM, 16 | [skynet.PTYPE_RESPONSE] = skynet.PTYPE_RESPONSE, -- don't free response message 17 | } 18 | 19 | skynet.forward_type( forward_map ,function() 20 | local clusterd = skynet.uniqueservice("clusterd") 21 | local n = tonumber(address) 22 | if n then 23 | address = n 24 | end 25 | skynet.dispatch("system", function (session, source, msg, sz) 26 | skynet.ret(skynet.rawcall(clusterd, "lua", skynet.pack("req", node, address, msg, sz))) 27 | end) 28 | end) 29 | -------------------------------------------------------------------------------- /depends/skynet/service/cmemory.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local memory = require "memory" 3 | 4 | memory.dumpinfo() 5 | --memory.dump() 6 | local info = memory.info() 7 | for k,v in pairs(info) do 8 | print(string.format(":%08x %gK",k,v/1024)) 9 | end 10 | 11 | print("Total memory:", memory.total()) 12 | print("Total block:", memory.block()) 13 | 14 | skynet.start(function() skynet.exit() end) 15 | -------------------------------------------------------------------------------- /depends/skynet/service/console.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local snax = require "snax" 3 | local socket = require "socket" 4 | 5 | local function split_cmdline(cmdline) 6 | local split = {} 7 | for i in string.gmatch(cmdline, "%S+") do 8 | table.insert(split,i) 9 | end 10 | return split 11 | end 12 | 13 | local function console_main_loop() 14 | local stdin = socket.stdin() 15 | socket.lock(stdin) 16 | while true do 17 | local cmdline = socket.readline(stdin, "\n") 18 | local split = split_cmdline(cmdline) 19 | local command = split[1] 20 | if command == "snax" then 21 | pcall(snax.newservice, select(2, table.unpack(split))) 22 | elseif cmdline ~= "" then 23 | pcall(skynet.newservice, cmdline) 24 | end 25 | end 26 | socket.unlock(stdin) 27 | end 28 | 29 | skynet.start(function() 30 | skynet.fork(console_main_loop) 31 | end) 32 | -------------------------------------------------------------------------------- /depends/skynet/service/dbg.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | 3 | local cmd = { ... } 4 | 5 | local function format_table(t) 6 | local index = {} 7 | for k in pairs(t) do 8 | table.insert(index, k) 9 | end 10 | table.sort(index) 11 | local result = {} 12 | for _,v in ipairs(index) do 13 | table.insert(result, string.format("%s:%s",v,tostring(t[v]))) 14 | end 15 | return table.concat(result,"\t") 16 | end 17 | 18 | local function dump_line(key, value) 19 | if type(value) == "table" then 20 | print(key, format_table(value)) 21 | else 22 | print(key,tostring(value)) 23 | end 24 | end 25 | 26 | local function dump_list(list) 27 | local index = {} 28 | for k in pairs(list) do 29 | table.insert(index, k) 30 | end 31 | table.sort(index) 32 | for _,v in ipairs(index) do 33 | dump_line(v, list[v]) 34 | end 35 | end 36 | 37 | skynet.start(function() 38 | local list = skynet.call(".launcher","lua", table.unpack(cmd)) 39 | if list then 40 | dump_list(list) 41 | end 42 | skynet.exit() 43 | end) -------------------------------------------------------------------------------- /depends/skynet/service/debug_agent.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local debugchannel = require "debugchannel" 3 | 4 | local CMD = {} 5 | 6 | local channel 7 | 8 | function CMD.start(address, fd) 9 | assert(channel == nil, "start more than once") 10 | skynet.error(string.format("Attach to :%08x", address)) 11 | local handle 12 | channel, handle = debugchannel.create() 13 | local ok, err = pcall(skynet.call, address, "debug", "REMOTEDEBUG", fd, handle) 14 | if not ok then 15 | skynet.ret(skynet.pack(false, "Debugger attach failed")) 16 | else 17 | -- todo hook 18 | skynet.ret(skynet.pack(true)) 19 | end 20 | skynet.exit() 21 | end 22 | 23 | function CMD.cmd(cmdline) 24 | channel:write(cmdline) 25 | end 26 | 27 | function CMD.ping() 28 | skynet.ret() 29 | end 30 | 31 | skynet.start(function() 32 | skynet.dispatch("lua", function(_,_,cmd,...) 33 | local f = CMD[cmd] 34 | f(...) 35 | end) 36 | end) 37 | -------------------------------------------------------------------------------- /depends/skynet/skynet: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/depends/skynet/skynet -------------------------------------------------------------------------------- /depends/skynet/skynet-src/atomic.h: -------------------------------------------------------------------------------- 1 | #ifndef SKYNET_ATOMIC_H 2 | #define SKYNET_ATOMIC_H 3 | 4 | #define ATOM_CAS(ptr, oval, nval) __sync_bool_compare_and_swap(ptr, oval, nval) 5 | #define ATOM_CAS_POINTER(ptr, oval, nval) __sync_bool_compare_and_swap(ptr, oval, nval) 6 | #define ATOM_INC(ptr) __sync_add_and_fetch(ptr, 1) 7 | #define ATOM_FINC(ptr) __sync_fetch_and_add(ptr, 1) 8 | #define ATOM_DEC(ptr) __sync_sub_and_fetch(ptr, 1) 9 | #define ATOM_FDEC(ptr) __sync_fetch_and_sub(ptr, 1) 10 | #define ATOM_ADD(ptr,n) __sync_add_and_fetch(ptr, n) 11 | #define ATOM_SUB(ptr,n) __sync_sub_and_fetch(ptr, n) 12 | #define ATOM_AND(ptr,n) __sync_and_and_fetch(ptr, n) 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /depends/skynet/skynet-src/luashrtbl.h: -------------------------------------------------------------------------------- 1 | #ifndef LUA_SHORT_STRING_TABLE_H 2 | #define LUA_SHORT_STRING_TABLE_H 3 | 4 | #include "lstring.h" 5 | 6 | // If you use modified lua, this macro would be defined in lstring.h 7 | #ifndef ENABLE_SHORT_STRING_TABLE 8 | 9 | static inline int luaS_shrinfo(lua_State *L) { return 0; } 10 | static inline void luaS_initshr() {} 11 | static inline void luaS_exitshr() {} 12 | static inline void luaS_expandshr(int n) {} 13 | 14 | #endif 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /depends/skynet/skynet-src/malloc_hook.h: -------------------------------------------------------------------------------- 1 | #ifndef SKYNET_MALLOC_HOOK_H 2 | #define SKYNET_MALLOC_HOOK_H 3 | 4 | #include 5 | #include 6 | 7 | extern size_t malloc_used_memory(void); 8 | extern size_t malloc_memory_block(void); 9 | extern void memory_info_dump(void); 10 | extern size_t mallctl_int64(const char* name, size_t* newval); 11 | extern int mallctl_opt(const char* name, int* newval); 12 | extern void dump_c_mem(void); 13 | extern int dump_mem_lua(lua_State *L); 14 | extern size_t malloc_current_memory(void); 15 | 16 | #endif /* SKYNET_MALLOC_HOOK_H */ 17 | 18 | -------------------------------------------------------------------------------- /depends/skynet/skynet-src/skynet_daemon.h: -------------------------------------------------------------------------------- 1 | #ifndef skynet_daemon_h 2 | #define skynet_daemon_h 3 | 4 | int daemon_init(const char *pidfile); 5 | int daemon_exit(const char *pidfile); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /depends/skynet/skynet-src/skynet_env.c: -------------------------------------------------------------------------------- 1 | #include "skynet.h" 2 | #include "skynet_env.h" 3 | #include "spinlock.h" 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | struct skynet_env { 12 | struct spinlock lock; 13 | lua_State *L; 14 | }; 15 | 16 | static struct skynet_env *E = NULL; 17 | 18 | const char * 19 | skynet_getenv(const char *key) { 20 | SPIN_LOCK(E) 21 | 22 | lua_State *L = E->L; 23 | 24 | lua_getglobal(L, key); 25 | const char * result = lua_tostring(L, -1); 26 | lua_pop(L, 1); 27 | 28 | SPIN_UNLOCK(E) 29 | 30 | return result; 31 | } 32 | 33 | void 34 | skynet_setenv(const char *key, const char *value) { 35 | SPIN_LOCK(E) 36 | 37 | lua_State *L = E->L; 38 | lua_getglobal(L, key); 39 | assert(lua_isnil(L, -1)); 40 | lua_pop(L,1); 41 | lua_pushstring(L,value); 42 | lua_setglobal(L,key); 43 | 44 | SPIN_UNLOCK(E) 45 | } 46 | 47 | void 48 | skynet_env_init() { 49 | E = skynet_malloc(sizeof(*E)); 50 | SPIN_INIT(E) 51 | E->L = luaL_newstate(); 52 | } 53 | -------------------------------------------------------------------------------- /depends/skynet/skynet-src/skynet_env.h: -------------------------------------------------------------------------------- 1 | #ifndef SKYNET_ENV_H 2 | #define SKYNET_ENV_H 3 | 4 | const char * skynet_getenv(const char *key); 5 | void skynet_setenv(const char *key, const char *value); 6 | 7 | void skynet_env_init(); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /depends/skynet/skynet-src/skynet_handle.h: -------------------------------------------------------------------------------- 1 | #ifndef SKYNET_CONTEXT_HANDLE_H 2 | #define SKYNET_CONTEXT_HANDLE_H 3 | 4 | #include 5 | 6 | // reserve high 8 bits for remote id 7 | #define HANDLE_MASK 0xffffff 8 | #define HANDLE_REMOTE_SHIFT 24 9 | 10 | struct skynet_context; 11 | 12 | uint32_t skynet_handle_register(struct skynet_context *); 13 | int skynet_handle_retire(uint32_t handle); 14 | struct skynet_context * skynet_handle_grab(uint32_t handle); 15 | void skynet_handle_retireall(); 16 | 17 | uint32_t skynet_handle_findname(const char * name); 18 | const char * skynet_handle_namehandle(uint32_t handle, const char *name); 19 | 20 | void skynet_handle_init(int harbor); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /depends/skynet/skynet-src/skynet_harbor.h: -------------------------------------------------------------------------------- 1 | #ifndef SKYNET_HARBOR_H 2 | #define SKYNET_HARBOR_H 3 | 4 | #include 5 | #include 6 | 7 | #define GLOBALNAME_LENGTH 16 8 | #define REMOTE_MAX 256 9 | 10 | struct remote_name { 11 | char name[GLOBALNAME_LENGTH]; 12 | uint32_t handle; 13 | }; 14 | 15 | struct remote_message { 16 | struct remote_name destination; 17 | const void * message; 18 | size_t sz; 19 | }; 20 | 21 | void skynet_harbor_send(struct remote_message *rmsg, uint32_t source, int session); 22 | int skynet_harbor_message_isremote(uint32_t handle); 23 | void skynet_harbor_init(int harbor); 24 | void skynet_harbor_start(void * ctx); 25 | void skynet_harbor_exit(); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /depends/skynet/skynet-src/skynet_imp.h: -------------------------------------------------------------------------------- 1 | #ifndef SKYNET_IMP_H 2 | #define SKYNET_IMP_H 3 | 4 | struct skynet_config { 5 | int thread; 6 | int harbor; 7 | int profile; 8 | const char * daemon; 9 | const char * module_path; 10 | const char * bootstrap; 11 | const char * logger; 12 | const char * logservice; 13 | }; 14 | 15 | #define THREAD_WORKER 0 16 | #define THREAD_MAIN 1 17 | #define THREAD_SOCKET 2 18 | #define THREAD_TIMER 3 19 | #define THREAD_MONITOR 4 20 | 21 | void skynet_start(struct skynet_config * config); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /depends/skynet/skynet-src/skynet_log.h: -------------------------------------------------------------------------------- 1 | #ifndef skynet_log_h 2 | #define skynet_log_h 3 | 4 | #include "skynet_env.h" 5 | #include "skynet.h" 6 | 7 | #include 8 | #include 9 | 10 | FILE * skynet_log_open(struct skynet_context * ctx, uint32_t handle); 11 | void skynet_log_close(struct skynet_context * ctx, FILE *f, uint32_t handle); 12 | void skynet_log_output(FILE *f, uint32_t source, int type, int session, void * buffer, size_t sz); 13 | 14 | #endif -------------------------------------------------------------------------------- /depends/skynet/skynet-src/skynet_malloc.h: -------------------------------------------------------------------------------- 1 | #ifndef skynet_malloc_h 2 | #define skynet_malloc_h 3 | 4 | #include 5 | 6 | #define skynet_malloc malloc 7 | #define skynet_calloc calloc 8 | #define skynet_realloc realloc 9 | #define skynet_free free 10 | 11 | void * skynet_malloc(size_t sz); 12 | void * skynet_calloc(size_t nmemb,size_t size); 13 | void * skynet_realloc(void *ptr, size_t size); 14 | void skynet_free(void *ptr); 15 | char * skynet_strdup(const char *str); 16 | void * skynet_lalloc(void *ptr, size_t osize, size_t nsize); // use for lua 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /depends/skynet/skynet-src/skynet_monitor.h: -------------------------------------------------------------------------------- 1 | #ifndef SKYNET_MONITOR_H 2 | #define SKYNET_MONITOR_H 3 | 4 | #include 5 | 6 | struct skynet_monitor; 7 | 8 | struct skynet_monitor * skynet_monitor_new(); 9 | void skynet_monitor_delete(struct skynet_monitor *); 10 | void skynet_monitor_trigger(struct skynet_monitor *, uint32_t source, uint32_t destination); 11 | void skynet_monitor_check(struct skynet_monitor *); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /depends/skynet/skynet-src/skynet_timer.h: -------------------------------------------------------------------------------- 1 | #ifndef SKYNET_TIMER_H 2 | #define SKYNET_TIMER_H 3 | 4 | #include 5 | 6 | int skynet_timeout(uint32_t handle, int time, int session); 7 | void skynet_updatetime(void); 8 | uint32_t skynet_starttime(void); 9 | uint64_t skynet_thread_time(void); // for profile, in micro second 10 | 11 | void skynet_timer_init(void); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /depends/skynet/skynet-src/socket_poll.h: -------------------------------------------------------------------------------- 1 | #ifndef socket_poll_h 2 | #define socket_poll_h 3 | 4 | #include 5 | 6 | typedef int poll_fd; 7 | 8 | struct event { 9 | void * s; 10 | bool read; 11 | bool write; 12 | }; 13 | 14 | static bool sp_invalid(poll_fd fd); 15 | static poll_fd sp_create(); 16 | static void sp_release(poll_fd fd); 17 | static int sp_add(poll_fd fd, int sock, void *ud); 18 | static void sp_del(poll_fd fd, int sock); 19 | static void sp_write(poll_fd, int sock, void *ud, bool enable); 20 | static int sp_wait(poll_fd, struct event *e, int max); 21 | static void sp_nonblocking(int sock); 22 | 23 | #ifdef __linux__ 24 | #include "socket_epoll.h" 25 | #endif 26 | 27 | #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined (__NetBSD__) 28 | #include "socket_kqueue.h" 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /depends/skynet/test/pingserver.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local queue = require "skynet.queue" 3 | local snax = require "snax" 4 | 5 | local i = 0 6 | local hello = "hello" 7 | 8 | function response.ping(hello) 9 | skynet.sleep(100) 10 | return hello 11 | end 12 | 13 | -- response.sleep and accept.hello share one lock 14 | local lock 15 | 16 | function accept.sleep(queue, n) 17 | if queue then 18 | lock( 19 | function() 20 | print("queue=",queue, n) 21 | skynet.sleep(n) 22 | end) 23 | else 24 | print("queue=",queue, n) 25 | skynet.sleep(n) 26 | end 27 | end 28 | 29 | function accept.hello() 30 | lock(function() 31 | i = i + 1 32 | print (i, hello) 33 | end) 34 | end 35 | 36 | function accept.exit(...) 37 | snax.exit(...) 38 | end 39 | 40 | function response.error() 41 | error "throw an error" 42 | end 43 | 44 | function init( ... ) 45 | print ("ping server start:", ...) 46 | snax.enablecluster() -- enable cluster call 47 | -- init queue 48 | lock = queue() 49 | end 50 | 51 | function exit(...) 52 | print ("ping server exit:", ...) 53 | end 54 | -------------------------------------------------------------------------------- /depends/skynet/test/sharemap.sp: -------------------------------------------------------------------------------- 1 | .foobar { 2 | x 0 : integer 3 | y 1 : integer 4 | s 2 : string 5 | } 6 | -------------------------------------------------------------------------------- /depends/skynet/test/testdatacenter.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local datacenter = require "datacenter" 3 | 4 | local function f1() 5 | print("====1==== wait hello") 6 | print("\t1>",datacenter.wait ("hello")) 7 | print("====1==== wait key.foobar") 8 | print("\t1>", pcall(datacenter.wait,"key")) -- will failed, because "key" is a branch 9 | print("\t1>",datacenter.wait ("key", "foobar")) 10 | end 11 | 12 | local function f2() 13 | skynet.sleep(10) 14 | print("====2==== set key.foobar") 15 | datacenter.set("key", "foobar", "bingo") 16 | end 17 | 18 | skynet.start(function() 19 | datacenter.set("hello", "world") 20 | print(datacenter.get "hello") 21 | skynet.fork(f1) 22 | skynet.fork(f2) 23 | end) 24 | -------------------------------------------------------------------------------- /depends/skynet/test/testdeadcall.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | 3 | local mode = ... 4 | 5 | if mode == "test" then 6 | 7 | skynet.start(function() 8 | skynet.dispatch("lua", function (...) 9 | print("====>", ...) 10 | skynet.exit() 11 | end) 12 | end) 13 | 14 | elseif mode == "dead" then 15 | 16 | skynet.start(function() 17 | skynet.dispatch("lua", function (...) 18 | skynet.sleep(100) 19 | print("return", skynet.ret "") 20 | end) 21 | end) 22 | 23 | else 24 | 25 | skynet.start(function() 26 | local test = skynet.newservice(SERVICE_NAME, "test") -- launch self in test mode 27 | 28 | print(pcall(function() 29 | skynet.call(test,"lua", "dead call") 30 | end)) 31 | 32 | local dead = skynet.newservice(SERVICE_NAME, "dead") -- launch self in dead mode 33 | 34 | skynet.timeout(0, skynet.exit) -- exit after a while, so the call never return 35 | skynet.call(dead, "lua", "whould not return") 36 | end) 37 | end 38 | -------------------------------------------------------------------------------- /depends/skynet/test/testdeadloop.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local function dead_loop() 3 | while true do 4 | skynet.sleep(0) 5 | end 6 | end 7 | 8 | skynet.start(function() 9 | skynet.fork(dead_loop) 10 | end) 11 | -------------------------------------------------------------------------------- /depends/skynet/test/testdns.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local dns = require "dns" 3 | 4 | skynet.start(function() 5 | print("nameserver:", dns.server()) -- set nameserver 6 | -- you can specify the server like dns.server("8.8.4.4", 53) 7 | local ip, ips = dns.resolve "github.com" 8 | for k,v in ipairs(ips) do 9 | print("github.com",v) 10 | end 11 | end) 12 | -------------------------------------------------------------------------------- /depends/skynet/test/testecho.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | 3 | local mode = ... 4 | 5 | if mode == "slave" then 6 | 7 | skynet.start(function() 8 | skynet.dispatch("lua", function(_,_, ...) 9 | skynet.ret(skynet.pack(...)) 10 | end) 11 | end) 12 | 13 | else 14 | 15 | skynet.start(function() 16 | local slave = skynet.newservice(SERVICE_NAME, "slave") 17 | local n = 100000 18 | local start = skynet.now() 19 | print("call salve", n, "times in queue") 20 | for i=1,n do 21 | skynet.call(slave, "lua") 22 | end 23 | print("qps = ", n/ (skynet.now() - start) * 100) 24 | 25 | start = skynet.now() 26 | 27 | local worker = 10 28 | local task = n/worker 29 | print("call salve", n, "times in parallel, worker = ", worker) 30 | 31 | for i=1,worker do 32 | skynet.fork(function() 33 | for i=1,task do 34 | skynet.call(slave, "lua") 35 | end 36 | worker = worker -1 37 | if worker == 0 then 38 | print("qps = ", n/ (skynet.now() - start) * 100) 39 | end 40 | end) 41 | end 42 | end) 43 | 44 | end 45 | -------------------------------------------------------------------------------- /depends/skynet/test/testendless.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | 3 | skynet.start(function() 4 | for i = 1, 1000000000 do -- very long loop 5 | if i%100000000 == 0 then 6 | print("Endless = ", skynet.stat "endless") 7 | print("Cost time = ", skynet.stat "time") 8 | end 9 | end 10 | skynet.exit() 11 | end) 12 | -------------------------------------------------------------------------------- /depends/skynet/test/testharborlink.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local harbor = require "skynet.harbor" 3 | 4 | skynet.start(function() 5 | print("wait for harbor 2") 6 | print("run skynet examples/config_log please") 7 | harbor.connect(2) 8 | print("harbor 2 connected") 9 | print("LOG =", skynet.address(harbor.queryname "LOG")) 10 | harbor.link(2) 11 | print("disconnected") 12 | end) 13 | -------------------------------------------------------------------------------- /depends/skynet/test/testhttp.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local httpc = require "http.httpc" 3 | local dns = require "dns" 4 | 5 | skynet.start(function() 6 | httpc.dns() -- set dns server 7 | httpc.timeout = 100 -- set timeout 1 second 8 | print("GET baidu.com") 9 | local respheader = {} 10 | local status, body = httpc.get("baidu.com", "/", respheader) 11 | print("[header] =====>") 12 | for k,v in pairs(respheader) do 13 | print(k,v) 14 | end 15 | print("[body] =====>", status) 16 | print(body) 17 | 18 | local respheader = {} 19 | dns.server() 20 | local ip = dns.resolve "baidu.com" 21 | print(string.format("GET %s (baidu.com)", ip)) 22 | local status, body = httpc.get("baidu.com", "/", respheader, { host = "baidu.com" }) 23 | print(status) 24 | 25 | skynet.exit() 26 | end) 27 | -------------------------------------------------------------------------------- /depends/skynet/test/testmemlimit.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | 3 | local names = {"cluster", "dns", "mongo", "mysql", "redis", "sharedata", "socket", "sproto"} 4 | 5 | -- set sandbox memory limit to 1M, must set here (at start, out of skynet.start) 6 | skynet.memlimit(1 * 1024 * 1024) 7 | 8 | skynet.start(function() 9 | local a = {} 10 | local limit 11 | local ok, err = pcall(function() 12 | for i=1, 12355 do 13 | limit = i 14 | table.insert(a, {}) 15 | end 16 | end) 17 | local libs = {} 18 | for k,v in ipairs(names) do 19 | local ok, m = pcall(require, v) 20 | if ok then 21 | libs[v] = m 22 | end 23 | end 24 | skynet.error(limit, err) 25 | skynet.exit() 26 | end) 27 | -------------------------------------------------------------------------------- /depends/skynet/test/testmulticast2.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local dc = require "datacenter" 3 | local mc = require "multicast" 4 | 5 | skynet.start(function() 6 | print("remote start") 7 | local console = skynet.newservice("console") 8 | local channel = dc.get "MCCHANNEL" 9 | if channel then 10 | print("remote channel", channel) 11 | else 12 | print("create local channel") 13 | end 14 | for i=1,10 do 15 | local sub = skynet.newservice("testmulticast", "sub") 16 | skynet.call(sub, "lua", "init", channel) 17 | end 18 | local c = mc.new { 19 | channel = channel , 20 | dispatch = function(...) print("======>", ...) end, 21 | } 22 | c:subscribe() 23 | c:publish("Remote message") 24 | c:unsubscribe() 25 | c:publish("Remote message2") 26 | c:delete() 27 | skynet.exit() 28 | end) 29 | -------------------------------------------------------------------------------- /depends/skynet/test/testoverload.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | 3 | local mode = ... 4 | 5 | if mode == "slave" then 6 | 7 | local CMD = {} 8 | 9 | function CMD.sum(n) 10 | skynet.error("for loop begin") 11 | local s = 0 12 | for i = 1, n do 13 | s = s + i 14 | end 15 | skynet.error("for loop end") 16 | end 17 | 18 | function CMD.blackhole() 19 | end 20 | 21 | skynet.start(function() 22 | skynet.dispatch("lua", function(_,_, cmd, ...) 23 | local f = CMD[cmd] 24 | f(...) 25 | end) 26 | end) 27 | 28 | else 29 | 30 | skynet.start(function() 31 | local slave = skynet.newservice(SERVICE_NAME, "slave") 32 | for step = 1, 20 do 33 | skynet.error("overload test ".. step) 34 | for i = 1, 512 * step do 35 | skynet.send(slave, "lua", "blackhole") 36 | end 37 | skynet.sleep(step) 38 | end 39 | local n = 1000000000 40 | skynet.error(string.format("endless test n=%d", n)) 41 | skynet.send(slave, "lua", "sum", n) 42 | end) 43 | 44 | end 45 | -------------------------------------------------------------------------------- /depends/skynet/test/testping.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local snax = require "snax" 3 | 4 | skynet.start(function() 5 | local ps = snax.newservice ("pingserver", "hello world") 6 | print(ps.req.ping("foobar")) 7 | print(ps.post.hello()) 8 | print(pcall(ps.req.error)) 9 | print("Hotfix (i) :", snax.hotfix(ps, [[ 10 | 11 | local i 12 | local hello 13 | 14 | function accept.hello() 15 | i = i + 1 16 | print ("fix", i, hello) 17 | end 18 | 19 | function hotfix(...) 20 | local temp = i 21 | i = 100 22 | return temp 23 | end 24 | 25 | ]])) 26 | print(ps.post.hello()) 27 | 28 | local info = skynet.call(ps.handle, "debug", "INFO") 29 | 30 | for name,v in pairs(info) do 31 | print(string.format("%s\tcount:%d time:%f", name, v.count, v.time)) 32 | end 33 | 34 | print(ps.post.exit("exit")) -- == snax.kill(ps, "exit") 35 | skynet.exit() 36 | end) 37 | -------------------------------------------------------------------------------- /depends/skynet/test/testqueue.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local snax = require "snax" 3 | 4 | skynet.start(function() 5 | local ps = snax.uniqueservice ("pingserver", "test queue") 6 | for i=1, 10 do 7 | ps.post.sleep(true,i*10) 8 | ps.post.hello() 9 | end 10 | for i=1, 10 do 11 | ps.post.sleep(false,i*10) 12 | ps.post.hello() 13 | end 14 | 15 | skynet.exit() 16 | end) 17 | 18 | 19 | -------------------------------------------------------------------------------- /depends/skynet/test/testresponse.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | 3 | local mode = ... 4 | 5 | if mode == "TICK" then 6 | -- this service whould response the request every 1s. 7 | 8 | local response_queue = {} 9 | 10 | local function response() 11 | while true do 12 | skynet.sleep(100) -- sleep 1s 13 | for k,v in ipairs(response_queue) do 14 | v(true, skynet.now()) -- true means succ, false means error 15 | response_queue[k] = nil 16 | end 17 | end 18 | end 19 | 20 | skynet.start(function() 21 | skynet.fork(response) 22 | skynet.dispatch("lua", function() 23 | table.insert(response_queue, skynet.response()) 24 | end) 25 | end) 26 | 27 | else 28 | 29 | local function request(tick, i) 30 | print(i, "call", skynet.now()) 31 | print(i, "response", skynet.call(tick, "lua")) 32 | print(i, "end", skynet.now()) 33 | end 34 | 35 | skynet.start(function() 36 | local tick = skynet.newservice(SERVICE_NAME, "TICK") 37 | 38 | for i=1,5 do 39 | skynet.fork(request, tick, i) 40 | skynet.sleep(10) 41 | end 42 | end) 43 | 44 | end -------------------------------------------------------------------------------- /depends/skynet/test/teststm.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local stm = require "stm" 3 | 4 | local mode = ... 5 | 6 | if mode == "slave" then 7 | 8 | skynet.start(function() 9 | skynet.dispatch("lua", function (_,_, obj) 10 | local obj = stm.newcopy(obj) 11 | print("read:", obj(skynet.unpack)) 12 | skynet.ret() 13 | skynet.error("sleep and read") 14 | for i=1,10 do 15 | skynet.sleep(10) 16 | print("read:", obj(skynet.unpack)) 17 | end 18 | skynet.exit() 19 | end) 20 | end) 21 | 22 | else 23 | 24 | skynet.start(function() 25 | local slave = skynet.newservice(SERVICE_NAME, "slave") 26 | local obj = stm.new(skynet.pack(1,2,3,4,5)) 27 | local copy = stm.copy(obj) 28 | skynet.call(slave, "lua", copy) 29 | for i=1,5 do 30 | skynet.sleep(20) 31 | print("write", i) 32 | obj(skynet.pack("hello world", i)) 33 | end 34 | skynet.exit() 35 | end) 36 | end 37 | -------------------------------------------------------------------------------- /depends/skynet/test/testterm.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | 3 | local function term() 4 | skynet.error("Sleep one second, and term the call to UNEXIST") 5 | skynet.sleep(100) 6 | local self = skynet.self() 7 | skynet.send(skynet.self(), "debug", "TERM", "UNEXIST") 8 | end 9 | 10 | skynet.start(function() 11 | skynet.fork(term) 12 | skynet.error("call an unexist named service UNEXIST, may block") 13 | pcall(skynet.call, "UNEXIST", "lua", "test") 14 | skynet.error("unblock the unexisted service call") 15 | end) 16 | -------------------------------------------------------------------------------- /depends/skynet/test/testtimer.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | 3 | local function timeout(t) 4 | print(t) 5 | end 6 | 7 | local function wakeup(co) 8 | for i=1,5 do 9 | skynet.sleep(50) 10 | skynet.wakeup(co) 11 | end 12 | end 13 | 14 | local function test() 15 | skynet.timeout(10, function() print("test timeout 10") end) 16 | for i=1,10 do 17 | print("test sleep",i,skynet.now()) 18 | skynet.sleep(1) 19 | end 20 | end 21 | 22 | skynet.start(function() 23 | test() 24 | 25 | skynet.fork(wakeup, coroutine.running()) 26 | skynet.timeout(300, function() timeout "Hello World" end) 27 | for i = 1, 10 do 28 | print(i, skynet.now()) 29 | print(skynet.sleep(100)) 30 | end 31 | skynet.exit() 32 | print("Test timer exit") 33 | 34 | end) 35 | -------------------------------------------------------------------------------- /depends/skynet/test/testudp.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | local socket = require "socket" 3 | 4 | local function server() 5 | local host 6 | host = socket.udp(function(str, from) 7 | print("server recv", str, socket.udp_address(from)) 8 | socket.sendto(host, from, "OK " .. str) 9 | end , "127.0.0.1", 8765) -- bind an address 10 | end 11 | 12 | local function client() 13 | local c = socket.udp(function(str, from) 14 | print("client recv", str, socket.udp_address(from)) 15 | end) 16 | socket.udp_connect(c, "127.0.0.1", 8765) 17 | for i=1,20 do 18 | socket.write(c, "hello " .. i) -- write to the address by udp_connect binding 19 | end 20 | end 21 | 22 | skynet.start(function() 23 | skynet.fork(server) 24 | skynet.fork(client) 25 | end) 26 | -------------------------------------------------------------------------------- /depends/skynet/test/time.lua: -------------------------------------------------------------------------------- 1 | local skynet = require "skynet" 2 | skynet.start(function() 3 | print(skynet.starttime()) 4 | print(skynet.now()) 5 | 6 | skynet.timeout(1, function() 7 | print("in 1", skynet.now()) 8 | end) 9 | skynet.timeout(2, function() 10 | print("in 2", skynet.now()) 11 | end) 12 | skynet.timeout(3, function() 13 | print("in 3", skynet.now()) 14 | end) 15 | 16 | skynet.timeout(4, function() 17 | print("in 4", skynet.now()) 18 | end) 19 | skynet.timeout(100, function() 20 | print("in 100", skynet.now()) 21 | end) 22 | end) 23 | -------------------------------------------------------------------------------- /image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/world100/skynet_hotfix/23762c88fcbd8b5a35f3abd991da5c388e40d9a1/image1.png -------------------------------------------------------------------------------- /killall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ps -efww|grep skynet|grep -v grep|cut -c 9-15|xargs kill -9 3 | -------------------------------------------------------------------------------- /server/common/algorithm/QStack.lua: -------------------------------------------------------------------------------- 1 | --栈,后进先出 2 | require "luaext" 3 | 4 | local QStack = class("QStack") 5 | 6 | function QStack:ctor() 7 | self.list = {} 8 | end 9 | 10 | function QStack:size() 11 | return #self.list 12 | end 13 | 14 | function QStack:push(node) 15 | if not node then 16 | return 17 | end 18 | table.insert(self.list,1,node) 19 | end 20 | 21 | function QStack:pop() 22 | if next(self.list) then 23 | return table.remove(self.list,1) 24 | end 25 | return nil 26 | end 27 | 28 | function QStack:remove(node) 29 | if next(self.list) then 30 | for k,v in pairs(self.list) do 31 | if v == node then 32 | table.remove(self.list,k) 33 | break 34 | end 35 | end 36 | end 37 | return nil 38 | end 39 | 40 | function QStack:print() 41 | for i=1,#self.list do 42 | print("---->",self.list[i]) 43 | end 44 | end 45 | 46 | local stack = QStack.new() 47 | stack:push(3) 48 | stack:push(4) 49 | stack:push(2) 50 | stack:push(1) 51 | stack:push(5) 52 | stack:remove(2) 53 | print("__pop__",stack:pop()) 54 | stack:print() -------------------------------------------------------------------------------- /server/common/algorithm/QTree.lua: -------------------------------------------------------------------------------- 1 | --树 2 | --[[ 3 | 前序遍历 根节点->左子树->右子树 4 | 中序遍历 左子树->根节点->右 5 | 后序遍历 左->右->根 6 | ]] 7 | 8 | require "luaext" 9 | 10 | local QTree = class("QTree") 11 | 12 | function QTree:ctor() 13 | 14 | end 15 | 16 | local tb = {1,2,3,4} 17 | -------------------------------------------------------------------------------- /server/common/base/preload.lua: -------------------------------------------------------------------------------- 1 | --预加载文件 2 | 3 | require "luaext" 4 | require "util" 5 | require "help" 6 | math.randomseed(os.time()) 7 | -------------------------------------------------------------------------------- /server/common/conf/confcenter.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: name 3 | -- DateTime: 2018-04-21 15:27:55 4 | -- Description: 服务间共享配置数据 5 | 6 | local skynet = require "skynet" 7 | local configtool = require "configtool" 8 | 9 | local setting_file = skynet.getenv("setting_file") 10 | --进程配置 11 | local function load_service_setting( ) 12 | local config = require(setting_file) 13 | for _,pro in pairs(config) do 14 | for k,v in pairs(pro) do 15 | if type(v) == 'table' then 16 | v.svr_id = k 17 | end 18 | end 19 | end 20 | configtool.share_new("setting_cfg", config) 21 | end 22 | 23 | local function load_config() 24 | load_service_setting() 25 | end 26 | 27 | skynet.start(function() 28 | configtool.begin() 29 | load_config() 30 | configtool.finish() 31 | end) -------------------------------------------------------------------------------- /server/common/conf/configquery.lua: -------------------------------------------------------------------------------- 1 | local sharedata = require "sharedata" 2 | 3 | local x_cfg = {} 4 | local x_cfg_buff = {} 5 | 6 | local _x_cfg_mt = { 7 | __index = function(t, k) 8 | local cfg = x_cfg_buff[k] 9 | if cfg == nil then 10 | cfg = sharedata.query(k) 11 | x_cfg_buff[k] = cfg 12 | end 13 | return cfg 14 | end 15 | } 16 | setmetatable(x_cfg, _x_cfg_mt) 17 | 18 | function x_cfg.clear() 19 | x_cfg_buff = {} 20 | end 21 | 22 | return x_cfg -------------------------------------------------------------------------------- /server/common/hotfix/test/hotfix_module_names.lua: -------------------------------------------------------------------------------- 1 | -- Module names need hotfix. 2 | -- hotfix_helper.lua will reload this module in check(). 3 | -- So it can be changed dynamically. 4 | 5 | local hotfix_module_names = { 6 | "test02", 7 | } 8 | 9 | return hotfix_module_names 10 | -------------------------------------------------------------------------------- /server/common/lang/Language.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: name 3 | -- DateTime: 2018-04-21 16:07:56 4 | -- Description: 语言类 5 | 6 | local Language = class("Language") 7 | 8 | g_language = nil 9 | 10 | function Language:getInstance(name) 11 | if not g_language then 12 | g_language = Language.new(name) 13 | end 14 | return g_language 15 | end 16 | 17 | function Language:ctor(name) 18 | self.tbLan = { 19 | "ch", 20 | "en", 21 | } 22 | self.tbText = {} 23 | for k,v in pairs(self.tbLan) do 24 | if name == v then 25 | self.tbText = require(v) 26 | break 27 | end 28 | end 29 | if not next(self.tbText) then 30 | self.tbText = require("ch") 31 | end 32 | end 33 | 34 | function Language:get(id) 35 | return self.tbText[id] or "" 36 | end 37 | 38 | 39 | return Language -------------------------------------------------------------------------------- /server/config/setting/server_setting.lua: -------------------------------------------------------------------------------- 1 | --进程端口相关配置 2 | 3 | return { 4 | 5 | loginserver = { 6 | { 7 | cluster = "0.0.0.0:17001", 8 | disable = 0, 9 | ip = "127.0.0.1", 10 | port = 17101, --socket端口 11 | port_ws = 17102, --websocket端口 12 | debug_port = 17103, 13 | maxclient = 10000, 14 | gate_size = 1, --服务的个数 15 | }, 16 | }, 17 | 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /server/loginserver/manager_service/manager_service.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: name 3 | -- DateTime: 2018-04-23 17:19:33 4 | -- Description: 服务管理 5 | 6 | 7 | require "skynet.manager" 8 | local skynet = require "skynet" 9 | local Hotfix = require("Hotfix") 10 | 11 | local MessageDispatch = import("MessageDispatch") 12 | local MessageHandler = import("MessageHandler") 13 | 14 | --服务唯一全局变量, 别的地方请不要注册全局变量, 请不要中途往global里加入变量 15 | global = {} 16 | 17 | 18 | local function init() 19 | 20 | --在luaext.lua 里有对类对象进行加入处理 21 | local hotfix = Hotfix.new() 22 | global.hotfix = hotfix 23 | 24 | local message_dispatch = MessageDispatch.new() 25 | local message_handler = MessageHandler.new(message_dispatch) 26 | 27 | 28 | 29 | skynet.dispatch("lua", message_dispatch:dispatch()) 30 | skynet.register('.proxy') 31 | end 32 | 33 | 34 | --------------------------------------------------------- 35 | -- skynet 36 | --------------------------------------------------------- 37 | 38 | skynet.start(function() 39 | 40 | init() 41 | 42 | end) -------------------------------------------------------------------------------- /server/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd "${1}" 3 | ../../depends/skynet/skynet "config${2}" "${1}" "${3}" --------------------------------------------------------------------------------