Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
1b79cd2e
Commit
1b79cd2e
authored
Jun 20, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
undo changes accidentally included in 09c5add99d50
R=ken2 CC=golang-dev
https://golang.org/cl/1736042
parent
45bdf036
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22 additions
and
37 deletions
+22
-37
src/cmd/prof/gopprof
src/cmd/prof/gopprof
+4
-2
src/pkg/image/png/reader.go
src/pkg/image/png/reader.go
+1
-2
src/pkg/rpc/client.go
src/pkg/rpc/client.go
+0
-6
src/pkg/rpc/jsonrpc/all_test.go
src/pkg/rpc/jsonrpc/all_test.go
+2
-4
src/pkg/rpc/jsonrpc/server.go
src/pkg/rpc/jsonrpc/server.go
+2
-2
src/pkg/rpc/server.go
src/pkg/rpc/server.go
+11
-21
test/arm-pass.txt
test/arm-pass.txt
+2
-0
No files found.
src/cmd/prof/gopprof
View file @
1b79cd2e
...
@@ -724,8 +724,10 @@ sub RunWeb {
...
@@ -724,8 +724,10 @@ sub RunWeb {
"firefox",
"firefox",
);
);
foreach my $b (@alt) {
foreach my $b (@alt) {
if (system($b, $fname) == 0) {
if (-f $b) {
return;
if (system($b, $fname) == 0) {
return;
}
}
}
}
}
...
...
src/pkg/image/png/reader.go
View file @
1b79cd2e
...
@@ -14,7 +14,6 @@ import (
...
@@ -14,7 +14,6 @@ import (
"image"
"image"
"io"
"io"
"os"
"os"
"strconv"
)
)
// Color type, as per the PNG spec.
// Color type, as per the PNG spec.
...
@@ -109,7 +108,7 @@ func (d *decoder) parseIHDR(r io.Reader, crc hash.Hash32, length uint32) os.Erro
...
@@ -109,7 +108,7 @@ func (d *decoder) parseIHDR(r io.Reader, crc hash.Hash32, length uint32) os.Erro
}
}
crc
.
Write
(
d
.
tmp
[
0
:
13
])
crc
.
Write
(
d
.
tmp
[
0
:
13
])
if
d
.
tmp
[
8
]
!=
8
{
if
d
.
tmp
[
8
]
!=
8
{
return
UnsupportedError
(
"bit depth
"
+
strconv
.
Itoa
(
int
(
d
.
tmp
[
8
]))
)
return
UnsupportedError
(
"bit depth
"
)
}
}
if
d
.
tmp
[
10
]
!=
0
||
d
.
tmp
[
11
]
!=
0
||
d
.
tmp
[
12
]
!=
0
{
if
d
.
tmp
[
10
]
!=
0
||
d
.
tmp
[
11
]
!=
0
||
d
.
tmp
[
12
]
!=
0
{
return
UnsupportedError
(
"compression, filter or interlace method"
)
return
UnsupportedError
(
"compression, filter or interlace method"
)
...
...
src/pkg/rpc/client.go
View file @
1b79cd2e
...
@@ -93,13 +93,7 @@ func (client *Client) input() {
...
@@ -93,13 +93,7 @@ func (client *Client) input() {
c
:=
client
.
pending
[
seq
]
c
:=
client
.
pending
[
seq
]
client
.
pending
[
seq
]
=
c
,
false
client
.
pending
[
seq
]
=
c
,
false
client
.
mutex
.
Unlock
()
client
.
mutex
.
Unlock
()
if
c
==
nil
{
err
=
os
.
NewError
(
"invalid response sequence number"
)
break
}
err
=
client
.
codec
.
ReadResponseBody
(
c
.
Reply
)
err
=
client
.
codec
.
ReadResponseBody
(
c
.
Reply
)
// TODO(rsc): Should look at err, but breaks tests.
// Empty strings should turn into nil os.Errors
// Empty strings should turn into nil os.Errors
if
response
.
Error
!=
""
{
if
response
.
Error
!=
""
{
c
.
Error
=
os
.
ErrorString
(
response
.
Error
)
c
.
Error
=
os
.
ErrorString
(
response
.
Error
)
...
...
src/pkg/rpc/jsonrpc/all_test.go
View file @
1b79cd2e
...
@@ -58,8 +58,7 @@ func TestServer(t *testing.T) {
...
@@ -58,8 +58,7 @@ func TestServer(t *testing.T) {
cli
,
srv
:=
net
.
Pipe
()
cli
,
srv
:=
net
.
Pipe
()
defer
cli
.
Close
()
defer
cli
.
Close
()
var
ci
rpc
.
ClientInfo
go
ServeConn
(
srv
)
go
ServeConn
(
srv
,
&
ci
)
dec
:=
json
.
NewDecoder
(
cli
)
dec
:=
json
.
NewDecoder
(
cli
)
// Send hand-coded requests to server, parse responses.
// Send hand-coded requests to server, parse responses.
...
@@ -85,9 +84,8 @@ func TestServer(t *testing.T) {
...
@@ -85,9 +84,8 @@ func TestServer(t *testing.T) {
func
TestClient
(
t
*
testing
.
T
)
{
func
TestClient
(
t
*
testing
.
T
)
{
// Assume server is okay (TestServer is above).
// Assume server is okay (TestServer is above).
// Test client against server.
// Test client against server.
var
ci
rpc
.
ClientInfo
cli
,
srv
:=
net
.
Pipe
()
cli
,
srv
:=
net
.
Pipe
()
go
ServeConn
(
srv
,
&
ci
)
go
ServeConn
(
srv
)
client
:=
NewClient
(
cli
)
client
:=
NewClient
(
cli
)
defer
client
.
Close
()
defer
client
.
Close
()
...
...
src/pkg/rpc/jsonrpc/server.go
View file @
1b79cd2e
...
@@ -118,6 +118,6 @@ func (c *serverCodec) Close() os.Error {
...
@@ -118,6 +118,6 @@ func (c *serverCodec) Close() os.Error {
// ServeConn runs the JSON-RPC server on a single connection.
// ServeConn runs the JSON-RPC server on a single connection.
// ServeConn blocks, serving the connection until the client hangs up.
// ServeConn blocks, serving the connection until the client hangs up.
// The caller typically invokes ServeConn in a go statement.
// The caller typically invokes ServeConn in a go statement.
func
ServeConn
(
conn
io
.
ReadWriteCloser
,
ci
*
rpc
.
ClientInfo
)
{
func
ServeConn
(
conn
io
.
ReadWriteCloser
)
{
rpc
.
ServeCodec
(
NewServerCodec
(
conn
)
,
ci
)
rpc
.
ServeCodec
(
NewServerCodec
(
conn
))
}
}
src/pkg/rpc/server.go
View file @
1b79cd2e
...
@@ -214,7 +214,7 @@ func (server *serverType) register(rcvr interface{}) os.Error {
...
@@ -214,7 +214,7 @@ func (server *serverType) register(rcvr interface{}) os.Error {
}
}
// Method needs three ins: receiver, *args, *reply.
// Method needs three ins: receiver, *args, *reply.
// The args and reply must be structs until gobs are more general.
// The args and reply must be structs until gobs are more general.
if
mtype
.
NumIn
()
!=
3
&&
mtype
.
NumIn
()
!=
4
{
if
mtype
.
NumIn
()
!=
3
{
log
.
Stderr
(
"method"
,
mname
,
"has wrong number of ins:"
,
mtype
.
NumIn
())
log
.
Stderr
(
"method"
,
mname
,
"has wrong number of ins:"
,
mtype
.
NumIn
())
continue
continue
}
}
...
@@ -301,19 +301,13 @@ func sendResponse(sending *sync.Mutex, req *Request, reply interface{}, codec Se
...
@@ -301,19 +301,13 @@ func sendResponse(sending *sync.Mutex, req *Request, reply interface{}, codec Se
sending
.
Unlock
()
sending
.
Unlock
()
}
}
func
(
s
*
service
)
call
(
sending
*
sync
.
Mutex
,
mtype
*
methodType
,
req
*
Request
,
argv
,
replyv
reflect
.
Value
,
codec
ServerCodec
,
ci
*
ClientInfo
)
{
func
(
s
*
service
)
call
(
sending
*
sync
.
Mutex
,
mtype
*
methodType
,
req
*
Request
,
argv
,
replyv
reflect
.
Value
,
codec
ServerCodec
)
{
mtype
.
Lock
()
mtype
.
Lock
()
mtype
.
numCalls
++
mtype
.
numCalls
++
mtype
.
Unlock
()
mtype
.
Unlock
()
function
:=
mtype
.
method
.
Func
function
:=
mtype
.
method
.
Func
// Invoke the method, providing a new value for the reply.
// Invoke the method, providing a new value for the reply.
var
args
[]
reflect
.
Value
returnValues
:=
function
.
Call
([]
reflect
.
Value
{
s
.
rcvr
,
argv
,
replyv
})
if
mtype
.
method
.
Type
.
NumIn
()
==
3
{
args
=
[]
reflect
.
Value
{
s
.
rcvr
,
argv
,
replyv
}
}
else
{
args
=
[]
reflect
.
Value
{
s
.
rcvr
,
argv
,
replyv
,
reflect
.
NewValue
(
ci
)}
}
returnValues
:=
function
.
Call
(
args
)
// The return value for the method is an os.Error.
// The return value for the method is an os.Error.
errInter
:=
returnValues
[
0
]
.
Interface
()
errInter
:=
returnValues
[
0
]
.
Interface
()
errmsg
:=
""
errmsg
:=
""
...
@@ -348,7 +342,7 @@ func (c *gobServerCodec) Close() os.Error {
...
@@ -348,7 +342,7 @@ func (c *gobServerCodec) Close() os.Error {
return
c
.
rwc
.
Close
()
return
c
.
rwc
.
Close
()
}
}
func
(
server
*
serverType
)
input
(
codec
ServerCodec
,
ci
*
ClientInfo
)
{
func
(
server
*
serverType
)
input
(
codec
ServerCodec
)
{
sending
:=
new
(
sync
.
Mutex
)
sending
:=
new
(
sync
.
Mutex
)
for
{
for
{
// Grab the request header.
// Grab the request header.
...
@@ -395,7 +389,7 @@ func (server *serverType) input(codec ServerCodec, ci *ClientInfo) {
...
@@ -395,7 +389,7 @@ func (server *serverType) input(codec ServerCodec, ci *ClientInfo) {
sendResponse
(
sending
,
req
,
replyv
.
Interface
(),
codec
,
err
.
String
())
sendResponse
(
sending
,
req
,
replyv
.
Interface
(),
codec
,
err
.
String
())
break
break
}
}
go
service
.
call
(
sending
,
mtype
,
req
,
argv
,
replyv
,
codec
,
ci
)
go
service
.
call
(
sending
,
mtype
,
req
,
argv
,
replyv
,
codec
)
}
}
codec
.
Close
()
codec
.
Close
()
}
}
...
@@ -406,7 +400,7 @@ func (server *serverType) accept(lis net.Listener) {
...
@@ -406,7 +400,7 @@ func (server *serverType) accept(lis net.Listener) {
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Exit
(
"rpc.Serve: accept:"
,
err
.
String
())
// TODO(r): exit?
log
.
Exit
(
"rpc.Serve: accept:"
,
err
.
String
())
// TODO(r): exit?
}
}
go
ServeConn
(
conn
,
&
ClientInfo
{
conn
.
LocalAddr
()
.
String
(),
conn
.
RemoteAddr
()
.
String
()}
)
go
ServeConn
(
conn
)
}
}
}
}
...
@@ -438,14 +432,14 @@ type ServerCodec interface {
...
@@ -438,14 +432,14 @@ type ServerCodec interface {
// The caller typically invokes ServeConn in a go statement.
// The caller typically invokes ServeConn in a go statement.
// ServeConn uses the gob wire format (see package gob) on the
// ServeConn uses the gob wire format (see package gob) on the
// connection. To use an alternate codec, use ServeCodec.
// connection. To use an alternate codec, use ServeCodec.
func
ServeConn
(
conn
io
.
ReadWriteCloser
,
ci
*
ClientInfo
)
{
func
ServeConn
(
conn
io
.
ReadWriteCloser
)
{
ServeCodec
(
&
gobServerCodec
{
conn
,
gob
.
NewDecoder
(
conn
),
gob
.
NewEncoder
(
conn
)}
,
ci
)
ServeCodec
(
&
gobServerCodec
{
conn
,
gob
.
NewDecoder
(
conn
),
gob
.
NewEncoder
(
conn
)})
}
}
// ServeCodec is like ServeConn but uses the specified codec to
// ServeCodec is like ServeConn but uses the specified codec to
// decode requests and encode responses.
// decode requests and encode responses.
func
ServeCodec
(
codec
ServerCodec
,
ci
*
ClientInfo
)
{
func
ServeCodec
(
codec
ServerCodec
)
{
server
.
input
(
codec
,
ci
)
server
.
input
(
codec
)
}
}
// Accept accepts connections on the listener and serves requests
// Accept accepts connections on the listener and serves requests
...
@@ -471,11 +465,7 @@ func serveHTTP(c *http.Conn, req *http.Request) {
...
@@ -471,11 +465,7 @@ func serveHTTP(c *http.Conn, req *http.Request) {
return
return
}
}
io
.
WriteString
(
conn
,
"HTTP/1.0 "
+
connected
+
"
\n\n
"
)
io
.
WriteString
(
conn
,
"HTTP/1.0 "
+
connected
+
"
\n\n
"
)
ci
:=
&
ClientInfo
{
ServeConn
(
conn
)
LocalAddr
:
conn
.
(
net
.
Conn
)
.
LocalAddr
()
.
String
(),
RemoteAddr
:
c
.
RemoteAddr
,
}
ServeConn
(
conn
,
ci
)
}
}
// HandleHTTP registers an HTTP handler for RPC messages.
// HandleHTTP registers an HTTP handler for RPC messages.
...
...
test/arm-pass.txt
View file @
1b79cd2e
...
@@ -48,6 +48,7 @@
...
@@ -48,6 +48,7 @@
# ./gc.go
# ./gc.go
# ./gc1.go
# ./gc1.go
./hashmap.go
./hashmap.go
./hilbert.go
./helloworld.go
./helloworld.go
./if.go
./if.go
./if1.go
./if1.go
...
@@ -331,6 +332,7 @@ fixedbugs/bug149.go
...
@@ -331,6 +332,7 @@ fixedbugs/bug149.go
fixedbugs/bug150.go
fixedbugs/bug150.go
fixedbugs/bug151.go
fixedbugs/bug151.go
fixedbugs/bug152.go
fixedbugs/bug152.go
fixedbugs/bug153.go
# fixedbugs/bug154.go # needs floating point
# fixedbugs/bug154.go # needs floating point
fixedbugs/bug155.go
fixedbugs/bug155.go
fixedbugs/bug156.go
fixedbugs/bug156.go
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment