Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1103)

Unified Diff: src/pkg/net/udpsock.go

Issue 154177: code review 154177: net: enforce timeouts for ReadFrom/WriteTo (Closed)
Patch Set: code review 154177: net: enforce timeouts for ReadFrom/WriteTo Created 15 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/net/timeout_test.go ('k') | src/pkg/net/unixsock.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/net/udpsock.go
===================================================================
--- a/src/pkg/net/udpsock.go
+++ b/src/pkg/net/udpsock.go
@@ -188,10 +188,7 @@
if !c.ok() {
return 0, nil, os.EINVAL
}
- n, sa, errno := syscall.Recvfrom(c.fd.fd, b, 0);
- if errno != 0 {
- err = os.Errno(errno)
- }
+ n, sa, err := c.fd.ReadFrom(b);
switch sa := sa.(type) {
case *syscall.SockaddrInet4:
addr = &UDPAddr{&sa.Addr, sa.Port}
@@ -228,10 +225,7 @@
if err != nil {
return 0, err
}
- if errno := syscall.Sendto(c.fd.fd, b, 0, sa); errno != 0 {
- return 0, os.Errno(errno)
- }
- return len(b), nil;
+ return c.fd.WriteTo(b, sa);
}
// WriteTo writes a UDP packet with payload b to addr via c.
« no previous file with comments | « src/pkg/net/timeout_test.go ('k') | src/pkg/net/unixsock.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b