Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行例子程序 提示 panic: Peer type not found: tcp.Acceptor #53

Closed
nosixtools opened this issue Aug 9, 2018 · 5 comments
Closed

Comments

@nosixtools
Copy link

如题

@davyxu
Copy link
Owner

davyxu commented Aug 9, 2018

哪个例子?报错详细提示?

运行下tests/Run.sh或者Run.bat会有问题么?

@nosixtools
Copy link
Author

README.md给的例子

@nosixtools
Copy link
Author

协议
syntax = "proto3";

package test;

message TestRequest {
string name = 1;
sint32 age = 2;
}

message TestResponse {
string info = 1;
}

代码
func main() {
queue := cellnet.NewEventQueue()
peerIns := peer.NewGenericPeer("tcp.Acceptor", "server", peerAddress, queue)
proc.BindProcessorHandler(peerIns, "tcp.ltv", func(ev cellnet.Event) {
switch ev.Message().(type) {
case *cellnet.SessionAccepted:
fmt.Println("server accepted")
case *cellnet.SessionClosed:
fmt.Println("session closed: ", ev.Session().ID())
case *test.TestRequest:
HandlerTestRequet(ev)
}
})
peerIns.Start()
queue.StartLoop()
}

@davyxu
Copy link
Owner

davyxu commented Aug 9, 2018

这是你自己改的代码出的问题,不是cellnet自己带的出问题。

import里加入
_ "github.com/davyxu/cellnet/peer/tcp"
_ "github.com/davyxu/cellnet/proc/tcp"

@bss03arg
Copy link

我也有同样的问题,应该很简单,但是没有解决,可惜了。

panic: peer type not found 'tcp.Acceptor'
try to add code below:
import (
_ "github.com/davyxu/cellnet/peer/tcp"
)

goroutine 1 [running]:
github.com/davyxu/cellnet/peer.NewPeer(0x13abbac, 0xc, 0xc000129ef8, 0x12ef756)
/Users/ccui/go/src/github.com/davyxu/cellnet/peer/peerreg.go:61 +0x62d
github.com/davyxu/cellnet/peer.NewGenericPeer(0x13abbac, 0xc, 0x13a9f33, 0x6, 0x13ac5c6, 0xf, 0x14236c0, 0xc00000e400, 0xc000129f88, 0x10075df)
/Users/ccui/go/src/github.com/davyxu/cellnet/peer/peerreg.go:72 +0x39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants