Comments (2)
Oddly much further in my development project, and just had this issue come up again. My code seems to be working despite it, which is a bit puzzling.
In this case, its occuring when I make an RPC call to the public IP from the the box that is serving the port.
e.g.:
2017/04/10 21:51:47 gorpc.Server: [66.128.118.34:56796]->[:1958]. Error when reading handshake from client: [EOF]
Where 66.128.118.34 is the public IP address of the machine itself. Will update when I figure this out.
from gorpc.
Hmmm, out of ideas. Fortunately the code snippets are fairly short.
Calling code:
37 // Active seed node already found in util.DNSsed() and stored in util.MyDNSServerIP
38
39 c := gorpc.NewTCPClient(util.MyDNSServerIP)
40 c.Start()
41 defer c.Stop()
42
43 d := gorpc.NewDispatcher()
44 d.AddFunc("PeerAdd", func(pi *PeerInfo) string {return PeerAdd(pi)})
45 d.AddFunc("PeerListAll", func() string {return PeerListAll()})
46
47 dc := d.NewFuncClient(c)
48 // Add yourself to your seed node, the seed will tell everyone else
49 _, err := dc.Call("PeerAdd", iAm)
50 if err != nil {
51 log.Critical("Accounce to seed", util.MyDNSServerIP, "failed:", err)
52 }
53 // Now go ask for all known nodes
54 plstr, err := dc.Call("PeerListAll",nil)
55 if err != nil {
56 log.Critical("Attempt to get PeerList from seed", util.MyDNSServerIP, "failed:", err)
57 }
Receiving code:
17 var extRPC = gorpc.NewDispatcher()
18 var intCmd *gorpc.Server
19 var extCmd *gorpc.Server
20
21 func Run(c chan bool) {
22
23 // Start common services
24 go server.Wallet(walletCmd)
25 go server.DB(dbCmd)
26
27 // External RPC service first
28 // Start by registering fucntions and types
29 extRPC.AddFunc("Ping", func() string { return "ePong!" })
30 extRPC.AddFunc("PeerAdd", func(pi *PeerInfo) string { return PeerAdd(pi) })
31 extRPC.AddFunc("PeerListAll", func() string { return PeerListAll() })
32
33 // Then launch the server
34 serverIP := ":" + strconv.Itoa(config.Archit.PortBase) // Listen on all interfaces
35 log.Info("Farmer External RPC Server using server address", serverIP)
36 extCmd = gorpc.NewTCPServer(serverIP, extRPC.NewHandlerFunc())
37 err := extCmd.Start()
38 if err != nil {
39 log.Critical("Farmer External RPC service failed to start: ", err)
40 }
41
42 defer extCmd.Stop()
And the handling function definitions themselves:
43 func PeerAdd(pi *PeerInfo) string {
132 func PeerListAll() string {
Which generate the above error when running, but otherwise appear to be working just fine.
Any suggestions would be greatly appreciated.
from gorpc.
Related Issues (20)
- thread-safe? HOT 2
- Build is breaking under go older than 1.4 HOT 2
- Dispatcher type validation is probably a bit too strict (bug) HOT 2
- Dealing with time.Time HOT 3
- Is it possible to add support of struct{}? HOT 2
- bidirectional support HOT 3
- Typo in dispatcher.go fatal log HOT 1
- windows call timeout HOT 3
- Can not register service after the server listens
- Dispatcher.AddService: allow clients to register interfaces
- does gorpc support multi languages?
- Consider exposing gorpc.Server.ServeConn HOT 1
- ConnStats.Snapshot example please
- WS supporting
- the docs make me confused, is there any project for reference? HOT 2
- Is this still a better choice than golang roc? HOT 2
- Custom Encoding
- Client connection cause server panic on ARM HOT 2
- add benchmark results to docs HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gorpc.