|
|
@ -6,10 +6,10 @@ import (
|
|
|
|
"net"
|
|
|
|
"net"
|
|
|
|
"syscall"
|
|
|
|
"syscall"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/op/go-logging"
|
|
|
|
|
|
|
|
"reflect"
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/op/go-logging"
|
|
|
|
"io"
|
|
|
|
"io"
|
|
|
|
|
|
|
|
"reflect"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const maxFdCount = 3
|
|
|
|
const maxFdCount = 3
|
|
|
@ -216,7 +216,6 @@ func (mc *MsgConn) readMessage() (*Message, error) {
|
|
|
|
// conn.AddHandlers(fooHandler, simpleHandler)
|
|
|
|
// conn.AddHandlers(fooHandler, simpleHandler)
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (mc *MsgConn) AddHandlers(args ...interface{}) error {
|
|
|
|
func (mc *MsgConn) AddHandlers(args ...interface{}) error {
|
|
|
|
for len(args) > 0 {
|
|
|
|
for len(args) > 0 {
|
|
|
|
if err := mc.disp.hmap.addHandler(args[0]); err != nil {
|
|
|
|
if err := mc.disp.hmap.addHandler(args[0]); err != nil {
|
|
|
@ -272,7 +271,6 @@ func getMessageType(msg interface{}) (string, error) {
|
|
|
|
return string(t.Field(0).Tag), nil
|
|
|
|
return string(t.Field(0).Tag), nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (mc *MsgConn) newBaseMessage(msgType string, msgID int, body interface{}) (*BaseMsg, error) {
|
|
|
|
func (mc *MsgConn) newBaseMessage(msgType string, msgID int, body interface{}) (*BaseMsg, error) {
|
|
|
|
bodyBytes, err := json.Marshal(body)
|
|
|
|
bodyBytes, err := json.Marshal(body)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
@ -298,4 +296,3 @@ func (mc *MsgConn) sendWithFds(data []byte, fds []int) error {
|
|
|
|
_, _, err := mc.conn.WriteMsgUnix(data, oob, nil)
|
|
|
|
_, _, err := mc.conn.WriteMsgUnix(data, oob, nil)
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|