Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Use RouteId rather than uint64 in UDPMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
bzEq committed Apr 7, 2024
1 parent bdc4250 commit d0fa740
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions intrinsic/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (self *ClientContext) dialUDP(network, addr string) (net.Conn, error) {
id := disp.NewEntry(addr)
defer disp.DeleteEntry(id)
cp := core.NewSyncPortWithTimeout(c, nil, core.DEFAULT_UDP_TIMEOUT)
r, err := router.NewRoute(core.RouteId(id), cp)
r, err := router.NewRoute(id, cp)
if err != nil {
log.Println(err)
return
Expand Down Expand Up @@ -184,7 +184,7 @@ func (self *UDPDispatcher) Encode(id core.RouteId, data *iovec.IoVec) error {
if !in {
return fmt.Errorf("Remote address of RouteId #%d doesn't exist", id)
}
msg := UDPMessage{Id: uint64(id), Addr: raddr, Data: data.Consume()}
msg := UDPMessage{Id: id, Addr: raddr, Data: data.Consume()}
var buf bytes.Buffer
enc := gob.NewEncoder(&buf)
if err := enc.Encode(&msg); err != nil {
Expand All @@ -201,5 +201,5 @@ func (self *UDPDispatcher) Decode(data *iovec.IoVec) (core.RouteId, error) {
return core.RouteId(^uint64(0)), err
}
data.Take(msg.Data)
return core.RouteId(msg.Id), nil
return msg.Id, nil
}
2 changes: 1 addition & 1 deletion intrinsic/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type TCPRequest struct {
}

type UDPMessage struct {
Id uint64
Id core.RouteId
Addr string
Data []byte
}
Expand Down

0 comments on commit d0fa740

Please sign in to comment.