UVGQA4JL7UY6HSEMU2JDRZLT44QJAVKV6ZBMWOFHDFHJZLTM5NKAC
module rpc
import net
import sync
import io
import json
struct Command {
verb string
}
pub fn setup(c chan string) {
l := net.listen_tcp(8099) or {
println('error opening rpc port')
return
}
println('rpc listening 8099')
for {
if conn := l.accept() {
mut reader := io.new_buffered_reader(reader: io.make_reader(conn))
for {
if line := reader.read_line() {
//_ := json.decode(Command, line) or { panic('a') }
if _ := json.decode(Command, line) { panic('a') } else { panic('b') }
if true {
println('accepted cmd')
} else {
println('json err')
}
} else {
break
}
}
} else {
println('error accept() tcp')
}
}
}