Last active
April 25, 2020 10:59
-
-
Save wudeng/1bc48a77378b0b95c063def164a79ef0 to your computer and use it in GitHub Desktop.
0 packet result in coroutine leak
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local skynet = require "skynet" | |
| local Utils = require "utils" | |
| local session_coroutine_id = Utils.get_func_upvalue(skynet.ignoreret, "session_coroutine_id") | |
| local count = 0 | |
| for _ in pairs(session_coroutine_id) do | |
| count = count + 1 | |
| end | |
| print(count) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "net" | |
| ) | |
| func main() { | |
| conn, err := net.Dial("tcp", "127.0.0.1:8290") | |
| if err != nil { | |
| fmt.Print("err", err) | |
| return | |
| } | |
| content := []byte{0, 0, 0, 0} | |
| for i := 0; i < 10000; i++ { | |
| _, err := conn.Write(content) | |
| if err != nil { | |
| fmt.Print("err", err) | |
| return | |
| } | |
| } | |
| fmt.Println("done") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local json = require "json" | |
| local orm = require "orm.orm" | |
| local resolve = require "orm.typedef" | |
| local define = [[ | |
| pictures [number] | |
| ]] | |
| local type_list = resolve.parse_string(define) | |
| orm.init(type_list) | |
| local data = orm.create("pictures", {1, 100,}) | |
| print(json.encode(data)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment