Commit 57a86cd5 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 547a6fa9
...@@ -122,7 +122,7 @@ const ( ...@@ -122,7 +122,7 @@ const (
LinkClient // link created as client LinkClient // link created as client
// for testing: // for testing:
linkNoRecvSend LinkRole = 1<<16 // do not spawn serveRecv & serveSend linkNoRecvSend LinkRole = 1 << 16 // do not spawn serveRecv & serveSend
linkFlagsMask LinkRole = (1<<32 - 1) << 16 linkFlagsMask LinkRole = (1<<32 - 1) << 16
) )
...@@ -148,7 +148,7 @@ const ( ...@@ -148,7 +148,7 @@ const (
func newNodeLink(conn net.Conn, role LinkRole) *NodeLink { func newNodeLink(conn net.Conn, role LinkRole) *NodeLink {
var nextConnId uint32 var nextConnId uint32
var acceptq chan *Conn var acceptq chan *Conn
switch role&^linkFlagsMask { switch role &^ linkFlagsMask {
case LinkServer: case LinkServer:
nextConnId = 0 // all initiated by us connId will be even nextConnId = 0 // all initiated by us connId will be even
acceptq = make(chan *Conn) // accept queue; TODO use backlog acceptq = make(chan *Conn) // accept queue; TODO use backlog
...@@ -776,7 +776,7 @@ func (c *Conn) Send(msg Msg) error { ...@@ -776,7 +776,7 @@ func (c *Conn) Send(msg Msg) error {
traceConnSendPre(c, msg) traceConnSendPre(c, msg)
l := msg.NEOMsgEncodedLen() l := msg.NEOMsgEncodedLen()
buf := PktBuf{make([]byte, PktHeadLen + l)} // TODO -> freelist buf := PktBuf{make([]byte, PktHeadLen+l)} // TODO -> freelist
h := buf.Header() h := buf.Header()
// h.ConnId will be set by conn.Send // h.ConnId will be set by conn.Send
......
//go:generate stringer -output proto-str2.go -type ErrorCode,NodeType proto.go //go:generate stringer -output zproto-str.go -type ErrorCode,NodeType proto.go
package neo package neo
......
//go:generate sh -c "go run protogen.go >proto-marshal.go" //go:generate sh -c "go run protogen.go >zproto-marshal.go"
package neo package neo
// protocol definition // protocol definition
......
...@@ -180,6 +180,8 @@ func main() { ...@@ -180,6 +180,8 @@ func main() {
buf.emit(`// Code generated by protogen.go; DO NOT EDIT. buf.emit(`// Code generated by protogen.go; DO NOT EDIT.
package neo package neo
// protocol messages to/from wire marshalling.
import ( import (
"encoding/binary" "encoding/binary"
"reflect" "reflect"
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
package neo package neo
// protocol messages to/from wire marshalling.
import ( import (
"encoding/binary" "encoding/binary"
"reflect" "reflect"
......
// Code generated by "stringer -output proto-str2.go -type ErrorCode,NodeType proto.go"; DO NOT EDIT. // Code generated by "stringer -output zproto-str.go -type ErrorCode,NodeType proto.go"; DO NOT EDIT.
package neo package neo
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment