summaryrefslogtreecommitdiffhomepage
path: root/server/peer.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-25 16:08:09 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-25 16:08:09 -0800
commit0adb1d0dcd57b17444a3364e576b3bcf94266ce4 (patch)
tree6d3fa06b869eaebf4ad795a7a4f278337bd2c41e /server/peer.go
parentdd0bd625475f07306b5176a9695d66a212249191 (diff)
rest: use []byte instead of interface{} for REST response
Some Marshall method is not thread-safe. They can't be called by a goroutine for a REST client. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r--server/peer.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/server/peer.go b/server/peer.go
index 1d7ec4a8..b3261dbd 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -106,7 +106,8 @@ func (peer *Peer) path2update(pathList []table.Path) []*bgp.BGPMessage {
func (peer *Peer) handleREST(restReq *api.RestRequest) {
result := &api.RestResponse{}
- result.Data = peer.rib.Tables[bgp.RF_IPv4_UC]
+ j, _ := json.Marshal(peer.rib.Tables[bgp.RF_IPv4_UC])
+ result.Data = j
restReq.ResponseCh <- result
close(restReq.ResponseCh)
}