kirill-scherba / teonet-go Goto Github PK
View Code? Open in Web Editor NEWTeonet go implementation
License: BSD 3-Clause "New" or "Revised" License
Teonet go implementation
License: BSD 3-Clause "New" or "Revised" License
ListBody get not completed key and send answer with array of keys data in json
format from key-value database
Event Connected from: ps-server
13:29:35.035466 channel.go:161: CONNECT (trudp) channel 5.63.153.144:9040:0 connected
13:29:35.035490 channel.go:161: CONNECT (trudp) channel 5.63.153.144:9020:0 connected
13:29:35.035511 teonet.go:256: CONNECT (teonet) got CONNECTED event, channel key: 5.63.153.144:9040:0
13:29:35.035548 teonet.go:256: CONNECT (teonet) got CONNECTED event, channel key: 5.63.153.144:9020:0
13:29:35.035794 channel.go:161: CONNECT (trudp) channel 5.63.153.144:1163:0 connected
13:29:35.035807 channel.go:161: CONNECT (trudp) channel 5.63.153.144:9010:0 connected
13:29:35.035824 teonet.go:256: CONNECT (teonet) got CONNECTED event, channel key: 5.63.153.144:1163:0
13:29:35.035856 teonet.go:256: CONNECT (teonet) got CONNECTED event, channel key: 5.63.153.144:9010:0
13:29:35.035909 channel.go:161: CONNECT (trudp) channel 5.63.153.144:1157:0 connected
13:29:35.035933 teonet.go:256: CONNECT (teonet) got CONNECTED event, channel key: 5.63.153.144:1157:0
13:29:35.037640 channel.go:161: CONNECT (trudp) channel 5.63.153.144:9080:0 connected
13:29:35.037662 teonet.go:256: CONNECT (teonet) got CONNECTED event, channel key: 5.63.153.144:9080:0
13:29:35.043637 channel.go:161: CONNECT (trudp) channel 95.217.5.176:9010:0 connected
13:29:35.043771 teonet.go:256: CONNECT (teonet) got CONNECTED event, channel key: 95.217.5.176:9010:0
13:29:35.045065 channel.go:210: CONNECT (trudp) connecting to host 192.168.102.246:58697 at channel 0
13:29:35.045562 channel.go:210: CONNECT (trudp) connecting to host 192.168.102.246:50448 at channel 0
13:29:35.046342 channel.go:161: CONNECT (trudp) channel 5.63.153.144:9100:0 connected
13:29:35.046410 teonet.go:256: CONNECT (teonet) got CONNECTED event, channel key: 5.63.153.144:9100:0
13:29:35.047589 channel.go:210: CONNECT (trudp) connecting to host 192.168.102.246:50211 at channel 0
13:29:35.047713 channel.go:210: CONNECT (trudp) connecting to host 192.168.102.246:53644 at channel 0
fatal error: concurrent map read and map write
goroutine 1 [running]:
runtime.throw(0x7bdce9, 0x21)
/usr/local/go/src/runtime/panic.go:774 +0x72 fp=0xc0000d39f0 sp=0xc0000d39c0 pc=0x430b12
runtime.mapaccess2_faststr(0x73f240, 0xc00008b1d0, 0xc000016ba0, 0x13, 0xc000016ba0, 0x13)
/usr/local/go/src/runtime/map_faststr.go:116 +0x48f fp=0xc0000d3a60 sp=0xc0000d39f0 pc=0x41600f
github.com/kirill-scherba/teonet-go/trudp/trudp.(*TRUDP).newChannelData(0xc00012c580, 0xc0001c0d20, 0x0, 0x1, 0x0, 0xc000016ba0, 0x13, 0x0)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/trudp/trudp/channel.go:168 +0xf9 fp=0xc0000d3ae0 sp=0xc0000d3a60 pc=0x531ab9
github.com/kirill-scherba/teonet-go/trudp/trudp.(*TRUDP).Run(0xc00012c580)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/trudp/trudp/trudp.go:322 +0x2b8 fp=0xc0000d3df0 sp=0xc0000d3ae0 pc=0x5382c8
github.com/kirill-scherba/teonet-go/teonet/teonet.(*Teonet).Run(0xc000114780, 0x7ce690)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/teonet/teonet.go:187 +0x19a fp=0xc0000d3ed0 sp=0xc0000d3df0 pc=0x6e7c9a
main.main()
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/main.go:28 +0x1cd fp=0xc0000d3f60 sp=0xc0000d3ed0 pc=0x6f223d
runtime.main()
/usr/local/go/src/runtime/proc.go:203 +0x21e fp=0xc0000d3fe0 sp=0xc0000d3f60 pc=0x4324ae
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc0000d3fe8 sp=0xc0000d3fe0 pc=0x45d9e1
2019/08/24 16:55:03.719939 l0.go:240: DEBUG (teonet) send cmd 65, 29 bytes data packet to peer teovpn, from client: teocli-go-main-test-01
^C2019/08/24 16:55:03.857208 l0.go:63: CONNECT (teonet) l0 server stop listen udp port: 9050
panic: close of closed channel
goroutine 34 [running]:
github.com/kirill-scherba/net-example-go/teonet/teonet.(*l0).destroy(0xc0000bc190)
/home/k_scherba/go/src/github.com/kirill-scherba/net-example-go/teonet/teonet/l0.go:67 +0x116
github.com/kirill-scherba/net-example-go/teonet/teonet.(*Teonet).Close(0xc000098000)
/home/k_scherba/go/src/github.com/kirill-scherba/net-example-go/teonet/teonet/teonet.go:163 +0x33
github.com/kirill-scherba/net-example-go/teonet/teonet.(*Teonet).CtrlC.func1(0xc0000a63c0, 0xc000098000)
/home/k_scherba/go/src/github.com/kirill-scherba/net-example-go/teonet/teonet/teonet.go:345 +0x12b
created by github.com/kirill-scherba/net-example-go/teonet/teonet.(*Teonet).CtrlC
/home/k_scherba/go/src/github.com/kirill-scherba/net-example-go/teonet/teonet/teonet.go:341 +0xdb
exit status 2
goroutine 20 [running]:
runtime.throw(0x7c2ec3, 0x21)
/usr/local/go/src/runtime/panic.go:774 +0x72 fp=0xc000337c68 sp=0xc000337c38 pc=0x430ad2
runtime.mapaccess2_faststr(0x742de0, 0xc00016a000, 0xc000437620, 0x29, 0xc00026586c, 0xc00023d180)
/usr/local/go/src/runtime/map_faststr.go:116 +0x48f fp=0xc000337cd8 sp=0xc000337c68 pc=0x415fcf
github.com/kirill-scherba/teonet-go/services/teoroom.(*Teoroom).resendData(0xc00016c000, 0xc000437620, 0x29, 0x432882, 0xc00033ffac, 0x11, 0x11, 0xc000337e20, 0x0, 0x0)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/services/teoroom/teoroom.go:83 +0x6a fp=0xc000337dd0 sp=0xc000337cd8 pc=0x6f381a
github.com/kirill-scherba/teonet-go/services/teoroom.(*Process).ComRoomData(0xc00016e000, 0xc000528760, 0x409355, 0xc000349c80)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/services/teoroom/teoroom.go:154 +0xea fp=0xc000337e40 sp=0xc000337dd0 pc=0x6f420a
main.main.func1(0xc000528760)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/app/teoroom/main.go:61 +0x208 fp=0xc000337f18 sp=0xc000337e40 pc=0x6f5448
main.main.func2(0xc0000f4780)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/app/teoroom/main.go:102 +0x1be fp=0xc000337fb0 sp=0xc000337f18 pc=0x6f579e
github.com/kirill-scherba/teonet-go/teonet/teonet.(*Teonet).Run.func3(0xc00016e008, 0xc00016e010)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/teonet/teonet.go:183 +0x56 fp=0xc000337fd0 sp=0xc000337fb0 pc=0x6ef966
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc000337fd8 sp=0xc000337fd0 pc=0x45d9a1
created by github.com/kirill-scherba/teonet-go/teonet/teonet.(*Teonet).Run
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/teonet/teonet.go:183 +0x16b
goroutine 1 [runnable]:
syscall.Syscall6(0x2d, 0x6, 0xc0001be000, 0x800, 0x0, 0xc0000b3750, 0xc0000b3744, 0xc, 0x800, 0x0)
/usr/local/go/src/syscall/asm_linux_amd64.s:44 +0x5
syscall.recvfrom(0x6, 0xc0001be000, 0x800, 0x800, 0x0, 0xc0000b3750, 0xc0000b3744, 0xffffffffffffffff, 0xc0000b3768, 0x42d73a)
/usr/local/go/src/syscall/zsyscall_linux_amd64.go:1618 +0xa3
syscall.Recvfrom(0x6, 0xc0001be000, 0x800, 0x800, 0x0, 0xffffffffffffffff, 0x0, 0x0, 0x832c20, 0xc383d8)
/usr/local/go/src/syscall/syscall_unix.go:273 +0xaf
internal/poll.(*FD).ReadFrom(0xc0000f4800, 0xc0001be000, 0x800, 0x800, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:215 +0x13e
net.(*netFD).readFrom(0xc0000f4800, 0xc0001be000, 0x800, 0x800, 0x8b68004077b5, 0x2000, 0x8, 0x7fdb474ae550, 0x7fdb473e6e60)
/usr/local/go/src/net/fd_unix.go:208 +0x5b
net.(*UDPConn).readFrom(0xc0000100b8, 0xc0001be000, 0x800, 0x800, 0x7fdb474e6d98, 0xc0000b3a4b, 0xc0001be000, 0x7fdb474ae550)
/usr/local/go/src/net/udpsock_posix.go:47 +0x6a
net.(*UDPConn).ReadFromUDP(0xc0000100b8, 0xc0001be000, 0x800, 0x800, 0xc000066598, 0x1, 0x1, 0xc0000b3a70)
/usr/local/go/src/net/udpsock.go:109 +0x5d
github.com/kirill-scherba/teonet-go/trudp/trudp.(*udp).readFrom(0xc000013200, 0xc0001be000, 0x800, 0x800, 0x1, 0xc0002902d0, 0x0, 0x0)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/trudp/trudp/udp.go:106 +0x16b
github.com/kirill-scherba/teonet-go/trudp/trudp.(*TRUDP).Run(0xc000110580)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/trudp/trudp/trudp.go:280 +0x8c
github.com/kirill-scherba/teonet-go/teonet/teonet.(*Teonet).Run(0xc0000f4780, 0xc000166030)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/teonet/teonet.go:187 +0x19a
main.main()
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/app/teoroom/main.go:74 +0x338
send and recieve id from L0 to CDB when register user;
rename fields (possible need):
we connect with users access tocken (send it in login command)
than l0 server and peers use users ID field in 'send to' and 'receive from'
13:01:28.475580 teonet.go:256: CONNECT (teonet) got CONNECTED event, channel key: 95.217.5.176:9010:0
13:01:28.475589 teonet.go:276: DEBUGvv (teonet) got 18 bytes packet, channel key: 95.217.5.176:9010:0
13:01:28.475601 crypt.go:83: DEBUGvv (teonet) decripted to 13 bytes packet, channel key: 95.217.5.176:9010:0
13:01:28.475615 teonet.go:427: DEBUGv (teonet) send cmd: 0, to: teo-d2-web, data_len: 1
13:01:28.475626 packet.go:118: DEBUGv (trudp) send DATA packet id: 0, to channel: 95.217.5.176:9010:0
13:01:28.475635 send_queue.go:73: DEBUGvv (trudp) add to send queue, id: 0
13:01:28.475662 teonet.go:427: DEBUGv (teonet) send cmd: 90, to: teo-d2-web, data_len: 1
13:01:28.475673 packet.go:118: DEBUGv (trudp) send DATA packet id: 1, to channel: 95.217.5.176:9010:0
13:01:28.475681 send_queue.go:73: DEBUGvv (trudp) add to send queue, id: 1
13:01:28.475709 command.go:245: DEBUGv (teonet) got cmd: 90, from: teo-d2-web, data_len: 0 (CMD_HOST_INFO command)
13:01:28.475725 teonet.go:427: DEBUGv (teonet) send cmd: 91, to: teo-d2-web, data_len: 18
13:01:28.475739 packet.go:118: DEBUGv (trudp) send DATA packet id: 2, to channel: 95.217.5.176:9010:0
13:01:28.475747 send_queue.go:73: DEBUGvv (trudp) add to send queue, id: 2
13:01:28.475772 teonet.go:276: DEBUGvv (teonet) got 66 bytes packet, channel key: 95.217.5.176:9010:0
13:01:28.475786 crypt.go:83: DEBUGvv (teonet) decripted to 50 bytes packet, channel key: 95.217.5.176:9010:0
13:01:28.475797 command.go:311: DEBUGv (teonet) got cmd: 91, from: teo-d2-web, data_len: 37 (CMD_HOST_INFO_ANSWER command)
13:01:28.475819 trudp.go:365: DEBUG (trudp) ChanEventClosed
panic: send on closed channel
goroutine 20 [running]:
github.com/kirill-scherba/teonet-go/teonet/teonet.(*waitCommand).check(0xc0000100b0, 0xc000180eb0, 0x0)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/teonet/command_wait.go:90 +0x292
github.com/kirill-scherba/teonet-go/teonet/teonet.(*command).process(0xc0000100a8, 0xc000180eb0, 0x0)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/teonet/command.go:135 +0x278
github.com/kirill-scherba/teonet-go/teonet/teonet.(*Teonet).read(0xc0000f6780, 0xc0000135e0, 0x0, 0x0)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/teonet/teonet.go:291 +0xceb
github.com/kirill-scherba/teonet-go/teonet/teonet.(*Teonet).Run.func1(0xc00019a000)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/teonet/teonet.go:159 +0xaf
created by github.com/kirill-scherba/teonet-go/teonet/teonet.(*Teonet).Run
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/teonet/teonet.go:154 +0x12f
exit status 2
panic: sync: negative WaitGroup counter
goroutine 6 [running]:
sync.(*WaitGroup).Add(0x4000320828, 0xffffffffffffffff)
/data/data/com.termux/files/usr/lib/go/src/sync/waitgroup.go:74 +0x13c
sync.(*WaitGroup).Done(...)
/data/data/com.termux/files/usr/lib/go/src/sync/waitgroup.go:99
github.com/kirill-scherba/teonet-go/trudp/trudp.(*TRUDP).ChanEventClosed(0x400017a2c0)
/data/data/com.termux/files/home/go/src/github.com/kirill-scherba/teonet-go/trudp/trudp/trudp.go:382 +0xa0
github.com/kirill-scherba/teonet-go/teocli/teocli.(*TeoLNull).Disconnect(0x40001c6080)
/data/data/com.termux/files/home/go/src/github.com/kirill-scherba/teonet-go/teocli/teocli/teonet_l0_client.go:94 +0x48
main.(*startCommand).Stop(0x4000094730)
/data/data/com.termux/files/home/go/src/github.com/kirill-scherba/teonet-go/teocli/examples/teocli-termloop/commands_output.go:58 +0x50
main.(*outputCommands).stop(...)
/data/data/com.termux/files/home/go/src/github.com/kirill-scherba/teonet-go/teocli/examples/teocli-termloop/commands_output.go:84
main.(*Teogame).start(0x40000f4000, 0x0)
/data/data/com.termux/files/home/go/src/github.com/kirill-scherba/teonet-go/teocli/examples/teocli-termloop/game.go:93 +0x1ac
created by main.(*startCommand).Command
/data/data/com.termux/files/home/go/src/github.com/kirill-scherba/teonet-go/teocli/examples/teocli-termloop/commands_output.go:35 +0x11c
Check reconnection to r-host:
It happens in rhost, when removed discovery tcd. Do this remove in kernel... (in trudp)
See this log:
issue_19.log
Teocli termloop application ver 0.0.1
name: 'g001-t2'
name: 'g001-e99351ff-ffed-11e9-9c54-107b4445878a'
Try TRUDP connecting to localhost:9010 ...
send login: 'g001-e99351ff-ffed-11e9-9c54-107b4445878a'
got event: 0
got event: 2
panic: can't write to: the channel 127.0.0.1:9010:0 already closed
goroutine 18 [running]:
main.(*Hero).Tick(0xc0001c4040, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teocli/examples/teocli-termloop/game_player.go:155 +0x3d8
github.com/JoelOtter/termloop.(*BaseLevel).Tick(0xc0001aa090, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/k_scherba/go/src/github.com/JoelOtter/termloop/level.go:34 +0xa6
github.com/JoelOtter/termloop.(*Screen).Tick(0xc0001b4000, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/k_scherba/go/src/github.com/JoelOtter/termloop/screen.go:35 +0xe6
github.com/JoelOtter/termloop.(*Game).Start(0xc0001aa060)
/home/k_scherba/go/src/github.com/JoelOtter/termloop/game.go:113 +0x62d
main.(*Teogame).start(0xc0000ce000, 0x0)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teocli/examples/teocli-termloop/game.go:88 +0x16a
created by main.(*startCommandD).Command
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teocli/examples/teocli-termloop/commands_output.go:27 +0x6d
exit status 2
When connect to r-host it send list peers IPs. Teonet try connect to this IPs. On off it connected and answer. Other has tcd channels than never removed.
Remove this channels after 1-2 seconds if it not related with peer.
It happens when l0-server not allow and client send message.
Event Connected from: teo-d2-web
14:33:53.313289 channel.go:86: CONNECT (trudp) channel with key 10.135.132.205:9010:0 disconnected
14:33:53.313357 teonet.go:262: CONNECT (teonet) got DISCONNECTED event, channel key: 10.135.132.205:9010:0
14:33:53.857168 channel.go:161: CONNECT (trudp) channel 10.135.132.205:9010:0 connected
14:33:53.857317 teonet.go:258: CONNECT (teonet) got CONNECTED event, channel key: 10.135.132.205:9010:0
14:33:53.857421 channel.go:86: CONNECT (trudp) channel with key 10.135.132.205:9010:0 disconnected
14:33:53.857538 teonet.go:262: CONNECT (teonet) got DISCONNECTED event, channel key: 10.135.132.205:9010:0
14:33:54.267054 channel.go:86: CONNECT (trudp) channel with key 172.17.0.1:9010:0 disconnected
14:33:54.267937 channel.go:86: CONNECT (trudp) channel with key 91.200.225.160:35909:0 disconnected
14:33:55.677944 channel.go:161: CONNECT (trudp) channel 127.0.0.1:40992:0 connected
14:33:55.678079 teonet.go:258: CONNECT (teonet) got CONNECTED event, channel key: 127.0.0.1:40992:0
14:33:55.678137 trudp.go:381: DEBUG (trudp) ChanEventClosed
panic: runtime error: index out of range [0] with length 0
goroutine 19 [running]:
github.com/kirill-scherba/teonet-go/teonet/teonet.(*Packet).Parse(0xc0001fae88, 0xc00028ecd0, 0x0, 0x7f4)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/teonet/packet.go:121 +0xc3
github.com/kirill-scherba/teonet-go/teonet/teonet.(*Teonet).read(0xc0000e2680, 0xc00009ccd0, 0x0, 0x0)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/teonet/teonet.go:293 +0xad1
github.com/kirill-scherba/teonet-go/teonet/teonet.(*Teonet).Run.func1(0xc0001dc000)
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/teonet/teonet.go:161 +0xaf
created by github.com/kirill-scherba/teonet-go/teonet/teonet.(*Teonet).Run
/home/k_scherba/go/src/github.com/kirill-scherba/teonet-go/teonet/teonet/teonet.go:156 +0x12f
exit status 2
Process get new id (GetID) command in teocdb and teocdbcli packages.
Add termux module to the project. Get statistic from toe-cdb and show it in this termux window.
SELECT count(disconnected) from clients WHERE disconnected <= '' ALLOW FILTERING ;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.