projects
/
platform
/
upstream
/
gcc48.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 4.8.1
[platform/upstream/gcc48.git]
/
libgo
/
go
/
net
/
rpc
/
jsonrpc
/
server.go
diff --git
a/libgo/go/net/rpc/jsonrpc/server.go
b/libgo/go/net/rpc/jsonrpc/server.go
index
4c54553
..
5bc05fd
100644
(file)
--- a/
libgo/go/net/rpc/jsonrpc/server.go
+++ b/
libgo/go/net/rpc/jsonrpc/server.go
@@
-12,6
+12,8
@@
import (
"sync"
)
"sync"
)
+var errMissingParams = errors.New("jsonrpc: request body missing params")
+
type serverCodec struct {
dec *json.Decoder // for reading JSON values
enc *json.Encoder // for writing JSON values
type serverCodec struct {
dec *json.Decoder // for reading JSON values
enc *json.Encoder // for writing JSON values
@@
-50,12
+52,8
@@
type serverRequest struct {
func (r *serverRequest) reset() {
r.Method = ""
func (r *serverRequest) reset() {
r.Method = ""
- if r.Params != nil {
- *r.Params = (*r.Params)[0:0]
- }
- if r.Id != nil {
- *r.Id = (*r.Id)[0:0]
- }
+ r.Params = nil
+ r.Id = nil
}
type serverResponse struct {
}
type serverResponse struct {
@@
-88,6
+86,9
@@
func (c *serverCodec) ReadRequestBody(x interface{}) error {
if x == nil {
return nil
}
if x == nil {
return nil
}
+ if c.req.Params == nil {
+ return errMissingParams
+ }
// JSON params is array value.
// RPC params is struct.
// Unmarshal into array containing struct for now.
// JSON params is array value.
// RPC params is struct.
// Unmarshal into array containing struct for now.