cleanup mprpc, add netlink stub file
This commit is contained in:
parent
b1bebae325
commit
4eb31163a4
|
@ -56,7 +56,7 @@ import (
|
|||
// ServiceFunc is a RPC service handler.
|
||||
// It can be created manually, or by using the generic MakeService function on a
|
||||
//
|
||||
// func(msgp.Encoder) (msgp.Deocder, error)
|
||||
// func(msgp.Encoder) (msgp.Decoder, error)
|
||||
//
|
||||
// type.
|
||||
type ServiceFunc func(params msgp.Raw) (res msgp.Raw, err error)
|
||||
|
@ -152,7 +152,6 @@ func (rpc *RPCConn) Serve() {
|
|||
case Response:
|
||||
cbCh, err := rpc.ct.Clear(rpcObject.MsgId)
|
||||
if err != nil {
|
||||
// TODO: scream
|
||||
rpc.Logger.Warn("could not get rpc callback", "msgid", rpcObject.MsgId, "err", err)
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -9,13 +9,12 @@ import (
|
|||
// RPCConntrack is a request-response tracker that is used to connect
|
||||
// the response to the appropriate caller.
|
||||
type rpcConnTrack struct {
|
||||
ct map[uint32]chan Response // TODO: change the values of the map for callbacks.
|
||||
ct map[uint32]chan Response
|
||||
mu sync.RWMutex
|
||||
}
|
||||
|
||||
// Get attempts to get a random mark from the mutex.
|
||||
func (c *rpcConnTrack) Claim() (uint32, chan Response) {
|
||||
// TODO: make this threadsafe.
|
||||
var val uint32
|
||||
for {
|
||||
|
||||
|
@ -50,7 +49,6 @@ func (c *rpcConnTrack) Claim() (uint32, chan Response) {
|
|||
// associated with it. The caller can use the channel afterwards
|
||||
// to send the response.
|
||||
func (c *rpcConnTrack) Clear(val uint32) (chan Response, error) {
|
||||
// TODO: get a lock
|
||||
c.mu.RLock()
|
||||
ch, ok := c.ct[val]
|
||||
c.mu.RUnlock()
|
||||
|
|
3
socketcan/netlink.go
Normal file
3
socketcan/netlink.go
Normal file
|
@ -0,0 +1,3 @@
|
|||
package socketcan
|
||||
|
||||
// TODO: implement netlink support to set baud rate and other parameters.
|
Loading…
Reference in a new issue