mirror of
https://github.com/golang/go
synced 2024-11-25 07:47:56 -07:00
pkg: spelling tweaks, I-Z
also, a few miscellaneous fixes to files outside pkg R=golang-dev, dsymonds, mikioh.mikioh, r CC=golang-dev https://golang.org/cl/4517116
This commit is contained in:
parent
9107b530d8
commit
3fbd478a8a
@ -495,7 +495,7 @@ func commitPoll(key string) {
|
|||||||
|
|
||||||
// Pass 1. Fill in parents and add new log entries to logsByHash.
|
// Pass 1. Fill in parents and add new log entries to logsByHash.
|
||||||
// Empty parent means take parent from next log entry.
|
// Empty parent means take parent from next log entry.
|
||||||
// Non-empty parent has form 1234:hashhashhash; we weant full hash.
|
// Non-empty parent has form 1234:hashhashhash; we want full hash.
|
||||||
for i := range logs {
|
for i := range logs {
|
||||||
l := &logs[i]
|
l := &logs[i]
|
||||||
log.Printf("hg log: %s < %s\n", l.Hash, l.Parent)
|
log.Printf("hg log: %s < %s\n", l.Hash, l.Parent)
|
||||||
@ -556,7 +556,7 @@ func addCommit(hash, key string) bool {
|
|||||||
|
|
||||||
// Create commit.
|
// Create commit.
|
||||||
if err := postCommit(key, l); err != nil {
|
if err := postCommit(key, l); err != nil {
|
||||||
log.Printf("faield to add %s to dashboard: %v", err)
|
log.Printf("failed to add %s to dashboard: %v", key, err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
@ -70,7 +70,7 @@ def upload(file, project_name, user_name, password, summary, labels=None):
|
|||||||
|
|
||||||
Returns: a tuple:
|
Returns: a tuple:
|
||||||
http_status: 201 if the upload succeeded, something else if an
|
http_status: 201 if the upload succeeded, something else if an
|
||||||
error occured.
|
error occurred.
|
||||||
http_reason: The human-readable string associated with http_status
|
http_reason: The human-readable string associated with http_status
|
||||||
file_url: If the upload succeeded, the URL of the file on Google
|
file_url: If the upload succeeded, the URL of the file on Google
|
||||||
Code, None otherwise.
|
Code, None otherwise.
|
||||||
|
@ -142,7 +142,7 @@ func dynimport(obj string) {
|
|||||||
if f, err := pe.Open(obj); err == nil {
|
if f, err := pe.Open(obj); err == nil {
|
||||||
sym, err := f.ImportedSymbols()
|
sym, err := f.ImportedSymbols()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fatalf("cannot load imported symbols from PE file %s: v", obj, err)
|
fatalf("cannot load imported symbols from PE file %s: %v", obj, err)
|
||||||
}
|
}
|
||||||
for _, s := range sym {
|
for _, s := range sym {
|
||||||
ss := strings.Split(s, ":", -1)
|
ss := strings.Split(s, ":", -1)
|
||||||
|
@ -170,7 +170,7 @@ me(kern_return_t r)
|
|||||||
// handles to tasks (processes), and handles to threads within a
|
// handles to tasks (processes), and handles to threads within a
|
||||||
// process. All of them are small integers.
|
// process. All of them are small integers.
|
||||||
//
|
//
|
||||||
// To accomodate Mach, we employ a clumsy hack: in this interface,
|
// To accommodate Mach, we employ a clumsy hack: in this interface,
|
||||||
// if you pass in a positive number, that's a process id.
|
// if you pass in a positive number, that's a process id.
|
||||||
// If you pass in a negative number, that identifies a thread that
|
// If you pass in a negative number, that identifies a thread that
|
||||||
// has been previously returned by procthreadpids (it indexes
|
// has been previously returned by procthreadpids (it indexes
|
||||||
|
@ -362,7 +362,7 @@ func (d *decoder) uninterlace(m *image.Paletted) {
|
|||||||
dx := d.width
|
dx := d.width
|
||||||
dy := d.height
|
dy := d.height
|
||||||
nPix = make([]uint8, dx*dy)
|
nPix = make([]uint8, dx*dy)
|
||||||
offset := 0 // steps through the input by sequentical scan lines.
|
offset := 0 // steps through the input by sequential scan lines.
|
||||||
for _, pass := range interlacing {
|
for _, pass := range interlacing {
|
||||||
nOffset := pass.start * dx // steps through the output as defined by pass.
|
nOffset := pass.start * dx // steps through the output as defined by pass.
|
||||||
for y := pass.start; y < dy; y += pass.skip {
|
for y := pass.start; y < dy; y += pass.skip {
|
||||||
|
@ -108,7 +108,7 @@ var testCases = []testCase{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// find all occurrences of s in source; report at most n occurences
|
// find all occurrences of s in source; report at most n occurrences
|
||||||
func find(src, s string, n int) []int {
|
func find(src, s string, n int) []int {
|
||||||
var res vector.IntVector
|
var res vector.IntVector
|
||||||
if s != "" && n != 0 {
|
if s != "" && n != 0 {
|
||||||
|
@ -23,7 +23,7 @@ package math
|
|||||||
// ====================================================
|
// ====================================================
|
||||||
//
|
//
|
||||||
// __ieee754_log(x)
|
// __ieee754_log(x)
|
||||||
// Return the logrithm of x
|
// Return the logarithm of x
|
||||||
//
|
//
|
||||||
// Method :
|
// Method :
|
||||||
// 1. Argument Reduction: find k and f such that
|
// 1. Argument Reduction: find k and f such that
|
||||||
|
@ -50,7 +50,7 @@ package math
|
|||||||
// If (2) is false, then q = q ; otherwise q = q + 2 .
|
// If (2) is false, then q = q ; otherwise q = q + 2 .
|
||||||
// i+1 i i+1 i
|
// i+1 i i+1 i
|
||||||
//
|
//
|
||||||
// With some algebric manipulation, it is not difficult to see
|
// With some algebraic manipulation, it is not difficult to see
|
||||||
// that (2) is equivalent to
|
// that (2) is equivalent to
|
||||||
// -(i+1)
|
// -(i+1)
|
||||||
// s + 2 <= y (3)
|
// s + 2 <= y (3)
|
||||||
|
@ -98,7 +98,7 @@ func (w *Writer) CreateFormFile(fieldname, filename string) (io.Writer, os.Error
|
|||||||
return w.CreatePart(h)
|
return w.CreatePart(h)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateFormField calls calls CreatePart with a header using the
|
// CreateFormField calls CreatePart with a header using the
|
||||||
// given field name.
|
// given field name.
|
||||||
func (w *Writer) CreateFormField(fieldname string) (io.Writer, os.Error) {
|
func (w *Writer) CreateFormField(fieldname string) (io.Writer, os.Error) {
|
||||||
h := make(textproto.MIMEHeader)
|
h := make(textproto.MIMEHeader)
|
||||||
|
@ -23,7 +23,7 @@ func TestWriter(t *testing.T) {
|
|||||||
part.Write(fileContents)
|
part.Write(fileContents)
|
||||||
err = w.WriteField("key", "val")
|
err = w.WriteField("key", "val")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("CreateFormFieldValue: %v", err)
|
t.Fatalf("WriteField: %v", err)
|
||||||
}
|
}
|
||||||
part.Write([]byte("val"))
|
part.Write([]byte("val"))
|
||||||
err = w.Close()
|
err = w.Close()
|
||||||
|
@ -84,7 +84,7 @@ func (o *bufOp) Init(fd *netFD, buf []byte) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// resultSrv will retreive all io completion results from
|
// resultSrv will retrieve all io completion results from
|
||||||
// iocp and send them to the correspondent waiting client
|
// iocp and send them to the correspondent waiting client
|
||||||
// goroutine via channel supplied in the request.
|
// goroutine via channel supplied in the request.
|
||||||
type resultSrv struct {
|
type resultSrv struct {
|
||||||
@ -513,7 +513,7 @@ func (fd *netFD) accept(toAddr func(syscall.Sockaddr) Addr) (nfd *netFD, err os.
|
|||||||
return nfd, nil
|
return nfd, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not implemeted functions.
|
// Unimplemented functions.
|
||||||
|
|
||||||
func (fd *netFD) dup() (f *os.File, err os.Error) {
|
func (fd *netFD) dup() (f *os.File, err os.Error) {
|
||||||
// TODO: Implement this
|
// TODO: Implement this
|
||||||
|
@ -113,7 +113,7 @@ func (ip IP) IsInterfaceLocalMulticast() bool {
|
|||||||
return len(ip) == IPv6len && ip[0] == 0xff && ip[1]&0x0f == 0x01
|
return len(ip) == IPv6len && ip[0] == 0xff && ip[1]&0x0f == 0x01
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsLinkLinkLocalMulticast returns true if ip is a link-local
|
// IsLinkLocalMulticast returns true if ip is a link-local
|
||||||
// multicast address.
|
// multicast address.
|
||||||
func (ip IP) IsLinkLocalMulticast() bool {
|
func (ip IP) IsLinkLocalMulticast() bool {
|
||||||
if ip4 := ip.To4(); ip4 != nil && ip4[0] == 224 && ip4[1] == 0 && ip4[2] == 0 {
|
if ip4 := ip.To4(); ip4 != nil && ip4[0] == 224 && ip4[1] == 0 && ip4[2] == 0 {
|
||||||
@ -122,7 +122,7 @@ func (ip IP) IsLinkLocalMulticast() bool {
|
|||||||
return ip[0] == 0xff && ip[1]&0x0f == 0x02
|
return ip[0] == 0xff && ip[1]&0x0f == 0x02
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsLinkLinkLocalUnicast returns true if ip is a link-local
|
// IsLinkLocalUnicast returns true if ip is a link-local
|
||||||
// unicast address.
|
// unicast address.
|
||||||
func (ip IP) IsLinkLocalUnicast() bool {
|
func (ip IP) IsLinkLocalUnicast() bool {
|
||||||
if ip4 := ip.To4(); ip4 != nil && ip4[0] == 169 && ip4[1] == 254 {
|
if ip4 := ip.To4(); ip4 != nil && ip4[0] == 169 && ip4[1] == 254 {
|
||||||
|
@ -62,7 +62,7 @@ var supportsIPv6, supportsIPv4map = probeIPv6Stack()
|
|||||||
// favoriteAddrFamily returns the appropriate address family to
|
// favoriteAddrFamily returns the appropriate address family to
|
||||||
// the given net, raddr, laddr and mode. At first it figures
|
// the given net, raddr, laddr and mode. At first it figures
|
||||||
// address family out from the net. If mode indicates "listen"
|
// address family out from the net. If mode indicates "listen"
|
||||||
// and laddr.(type).IP is nil, it assuumes that the user wants to
|
// and laddr.(type).IP is nil, it assumes that the user wants to
|
||||||
// make a passive connection with wildcard address family, both
|
// make a passive connection with wildcard address family, both
|
||||||
// INET and INET6, and wildcard address. Otherwise guess: if the
|
// INET and INET6, and wildcard address. Otherwise guess: if the
|
||||||
// addresses are IPv4 then returns INET, or else returns INET6.
|
// addresses are IPv4 then returns INET, or else returns INET6.
|
||||||
@ -145,7 +145,7 @@ func ipv6only(x IP) IP {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(rsc): if syscall.OS == "linux", we're supposd to read
|
// TODO(rsc): if syscall.OS == "linux", we're supposed to read
|
||||||
// /proc/sys/net/core/somaxconn,
|
// /proc/sys/net/core/somaxconn,
|
||||||
// to take advantage of kernels that have raised the limit.
|
// to take advantage of kernels that have raised the limit.
|
||||||
func listenBacklog() int { return syscall.SOMAXCONN }
|
func listenBacklog() int { return syscall.SOMAXCONN }
|
||||||
|
@ -237,7 +237,7 @@ func (r *Reader) ReadResponse(expectCode int) (code int, message string, err os.
|
|||||||
// to a method on r.
|
// to a method on r.
|
||||||
//
|
//
|
||||||
// Dot encoding is a common framing used for data blocks
|
// Dot encoding is a common framing used for data blocks
|
||||||
// in text protcols like SMTP. The data consists of a sequence
|
// in text protocols such as SMTP. The data consists of a sequence
|
||||||
// of lines, each of which ends in "\r\n". The sequence itself
|
// of lines, each of which ends in "\r\n". The sequence itself
|
||||||
// ends at a line containing just a dot: ".\r\n". Lines beginning
|
// ends at a line containing just a dot: ".\r\n". Lines beginning
|
||||||
// with a dot are escaped with an additional dot to avoid
|
// with a dot are escaped with an additional dot to avoid
|
||||||
|
@ -142,7 +142,7 @@ func pdir(b []byte, d *Dir) []byte {
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalDir reads a 9P Stat message from a 9P protocol message strored in b,
|
// UnmarshalDir reads a 9P Stat message from a 9P protocol message stored in b,
|
||||||
// returning the corresponding Dir struct.
|
// returning the corresponding Dir struct.
|
||||||
func UnmarshalDir(b []byte) (d *Dir, err Error) {
|
func UnmarshalDir(b []byte) (d *Dir, err Error) {
|
||||||
n := uint16(0)
|
n := uint16(0)
|
||||||
@ -172,7 +172,7 @@ func UnmarshalDir(b []byte) (d *Dir, err Error) {
|
|||||||
return d, nil
|
return d, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// gqid reads the qid part of a 9P Stat message from a 9P protocol message strored in b,
|
// gqid reads the qid part of a 9P Stat message from a 9P protocol message stored in b,
|
||||||
// returning the corresponding Qid struct and the remaining slice of b.
|
// returning the corresponding Qid struct and the remaining slice of b.
|
||||||
func gqid(b []byte) (Qid, []byte) {
|
func gqid(b []byte) (Qid, []byte) {
|
||||||
var q Qid
|
var q Qid
|
||||||
@ -190,25 +190,25 @@ func pqid(b []byte, q Qid) []byte {
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// gbit8 reads a byte-sized numeric value from a 9P protocol message strored in b,
|
// gbit8 reads a byte-sized numeric value from a 9P protocol message stored in b,
|
||||||
// returning the value and the remaining slice of b.
|
// returning the value and the remaining slice of b.
|
||||||
func gbit8(b []byte) (uint8, []byte) {
|
func gbit8(b []byte) (uint8, []byte) {
|
||||||
return uint8(b[0]), b[1:]
|
return uint8(b[0]), b[1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
// gbit16 reads a 16-bit numeric value from a 9P protocol message strored in b,
|
// gbit16 reads a 16-bit numeric value from a 9P protocol message stored in b,
|
||||||
// returning the value and the remaining slice of b.
|
// returning the value and the remaining slice of b.
|
||||||
func gbit16(b []byte) (uint16, []byte) {
|
func gbit16(b []byte) (uint16, []byte) {
|
||||||
return uint16(b[0]) | uint16(b[1])<<8, b[2:]
|
return uint16(b[0]) | uint16(b[1])<<8, b[2:]
|
||||||
}
|
}
|
||||||
|
|
||||||
// gbit32 reads a 32-bit numeric value from a 9P protocol message strored in b,
|
// gbit32 reads a 32-bit numeric value from a 9P protocol message stored in b,
|
||||||
// returning the value and the remaining slice of b.
|
// returning the value and the remaining slice of b.
|
||||||
func gbit32(b []byte) (uint32, []byte) {
|
func gbit32(b []byte) (uint32, []byte) {
|
||||||
return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24, b[4:]
|
return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24, b[4:]
|
||||||
}
|
}
|
||||||
|
|
||||||
// gbit64 reads a 64-bit numeric value from a 9P protocol message strored in b,
|
// gbit64 reads a 64-bit numeric value from a 9P protocol message stored in b,
|
||||||
// returning the value and the remaining slice of b.
|
// returning the value and the remaining slice of b.
|
||||||
func gbit64(b []byte) (uint64, []byte) {
|
func gbit64(b []byte) (uint64, []byte) {
|
||||||
lo, b := gbit32(b)
|
lo, b := gbit32(b)
|
||||||
@ -216,7 +216,7 @@ func gbit64(b []byte) (uint64, []byte) {
|
|||||||
return uint64(hi)<<32 | uint64(lo), b
|
return uint64(hi)<<32 | uint64(lo), b
|
||||||
}
|
}
|
||||||
|
|
||||||
// gstring reads a string from a 9P protocol message strored in b,
|
// gstring reads a string from a 9P protocol message stored in b,
|
||||||
// returning the value as a Go string and the remaining slice of b.
|
// returning the value as a Go string and the remaining slice of b.
|
||||||
func gstring(b []byte) (string, []byte) {
|
func gstring(b []byte) (string, []byte) {
|
||||||
n, b := gbit16(b)
|
n, b := gbit16(b)
|
||||||
|
@ -173,7 +173,7 @@ type nonEmptyInterface struct {
|
|||||||
// Regarding the implementation of Value:
|
// Regarding the implementation of Value:
|
||||||
//
|
//
|
||||||
// The Internal interface is a true interface value in the Go sense,
|
// The Internal interface is a true interface value in the Go sense,
|
||||||
// but it also serves as a (type, address) pair in whcih one cannot
|
// but it also serves as a (type, address) pair in which one cannot
|
||||||
// be changed separately from the other. That is, it serves as a way
|
// be changed separately from the other. That is, it serves as a way
|
||||||
// to prevent unsafe mutations of the Internal state even though
|
// to prevent unsafe mutations of the Internal state even though
|
||||||
// we cannot (yet?) hide the field while preserving the ability for
|
// we cannot (yet?) hide the field while preserving the ability for
|
||||||
|
@ -356,7 +356,7 @@ func BenchmarkMatchClass(b *testing.B) {
|
|||||||
|
|
||||||
func BenchmarkMatchClass_InRange(b *testing.B) {
|
func BenchmarkMatchClass_InRange(b *testing.B) {
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
// 'b' is betwen 'a' and 'c', so the charclass
|
// 'b' is between 'a' and 'c', so the charclass
|
||||||
// range checking is no help here.
|
// range checking is no help here.
|
||||||
x := strings.Repeat("bbbb", 20) + "c"
|
x := strings.Repeat("bbbb", 20) + "c"
|
||||||
re := MustCompile("[ac]")
|
re := MustCompile("[ac]")
|
||||||
|
@ -105,7 +105,7 @@ loop:
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* compare numerator to denominator
|
* compare numerator to denominator
|
||||||
* if less, subtract and set quotent bit
|
* if less, subtract and set quotient bit
|
||||||
*/
|
*/
|
||||||
CMP R(D), R(N)
|
CMP R(D), R(N)
|
||||||
ORR.HS $1, R(Q)
|
ORR.HS $1, R(Q)
|
||||||
|
@ -116,7 +116,7 @@ again:
|
|||||||
//
|
//
|
||||||
// We only really care that (v&1) == 1 (the lock is held),
|
// We only really care that (v&1) == 1 (the lock is held),
|
||||||
// and in fact there is a futex variant that could
|
// and in fact there is a futex variant that could
|
||||||
// accomodate that check, but let's not get carried away.)
|
// accommodate that check, but let's not get carried away.)
|
||||||
futexsleep(&l->key, v+2);
|
futexsleep(&l->key, v+2);
|
||||||
|
|
||||||
// We're awake: remove ourselves from the count.
|
// We're awake: remove ourselves from the count.
|
||||||
|
@ -113,7 +113,7 @@ static uintptr addrmem;
|
|||||||
// hashMultiplier is the bottom 32 bits of int((sqrt(5)-1)/2 * (1<<32)).
|
// hashMultiplier is the bottom 32 bits of int((sqrt(5)-1)/2 * (1<<32)).
|
||||||
// This is a good multiplier as suggested in CLR, Knuth. The hash
|
// This is a good multiplier as suggested in CLR, Knuth. The hash
|
||||||
// value is taken to be the top AddrHashBits bits of the bottom 32 bits
|
// value is taken to be the top AddrHashBits bits of the bottom 32 bits
|
||||||
// of the muliplied value.
|
// of the multiplied value.
|
||||||
enum {
|
enum {
|
||||||
HashMultiplier = 2654435769U
|
HashMultiplier = 2654435769U
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# Use of this source code is governed by a BSD-style
|
# Use of this source code is governed by a BSD-style
|
||||||
# license that can be found in the LICENSE file.
|
# license that can be found in the LICENSE file.
|
||||||
|
|
||||||
"""GDB Pretty printers and convencience functions for Go's runtime structures.
|
"""GDB Pretty printers and convenience functions for Go's runtime structures.
|
||||||
|
|
||||||
This script is loaded by GDB when it finds a .debug_gdb_scripts
|
This script is loaded by GDB when it finds a .debug_gdb_scripts
|
||||||
section in the compiled binary. The [68]l linkers emit this with a
|
section in the compiled binary. The [68]l linkers emit this with a
|
||||||
@ -393,7 +393,7 @@ class GoIfaceCmd(gdb.Command):
|
|||||||
# so Itype will start with a commontype which has kind = interface
|
# so Itype will start with a commontype which has kind = interface
|
||||||
|
|
||||||
#
|
#
|
||||||
# Register all convience functions and CLI commands
|
# Register all convenience functions and CLI commands
|
||||||
#
|
#
|
||||||
for k in vars().values():
|
for k in vars().values():
|
||||||
if hasattr(k, 'invoke'):
|
if hasattr(k, 'invoke'):
|
||||||
|
@ -306,7 +306,7 @@ enum {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* defined macros
|
* defined macros
|
||||||
* you need super-goru privilege
|
* you need super-gopher-guru privilege
|
||||||
* to add this list.
|
* to add this list.
|
||||||
*/
|
*/
|
||||||
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
|
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
|
||||||
|
@ -108,7 +108,7 @@ func newDecimal(i uint64) *decimal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Maximum shift that we can do in one pass without overflow.
|
// Maximum shift that we can do in one pass without overflow.
|
||||||
// Signed int has 31 bits, and we have to be able to accomodate 9<<k.
|
// Signed int has 31 bits, and we have to be able to accommodate 9<<k.
|
||||||
const maxShift = 27
|
const maxShift = 27
|
||||||
|
|
||||||
// Binary shift right (* 2) by k bits. k <= maxShift to avoid overflow.
|
// Binary shift right (* 2) by k bits. k <= maxShift to avoid overflow.
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
const darwinAMD64 = OS == "darwin" && ARCH == "amd64"
|
const darwinAMD64 = OS == "darwin" && ARCH == "amd64"
|
||||||
|
|
||||||
// Round the length of a raw sockaddr up to align it propery.
|
// Round the length of a raw sockaddr up to align it properly.
|
||||||
func rsaAlignOf(salen int) int {
|
func rsaAlignOf(salen int) int {
|
||||||
salign := sizeofPtr
|
salign := sizeofPtr
|
||||||
// NOTE: It seems like 64-bit Darwin kernel still requires 32-bit
|
// NOTE: It seems like 64-bit Darwin kernel still requires 32-bit
|
||||||
|
@ -158,7 +158,7 @@ const (
|
|||||||
TabIndent
|
TabIndent
|
||||||
|
|
||||||
// Print a vertical bar ('|') between columns (after formatting).
|
// Print a vertical bar ('|') between columns (after formatting).
|
||||||
// Discarded colums appear as zero-width columns ("||").
|
// Discarded columns appear as zero-width columns ("||").
|
||||||
Debug
|
Debug
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ func wakeLoop(wakeMeAt chan int64, wakeUp chan bool) {
|
|||||||
|
|
||||||
// A single tickerLoop serves all ticks to Tickers. It waits for two events:
|
// A single tickerLoop serves all ticks to Tickers. It waits for two events:
|
||||||
// either the creation of a new Ticker or a tick from the alarm,
|
// either the creation of a new Ticker or a tick from the alarm,
|
||||||
// signalling a time to wake up one or more Tickers.
|
// signaling a time to wake up one or more Tickers.
|
||||||
func tickerLoop() {
|
func tickerLoop() {
|
||||||
// Represents the next alarm to be delivered.
|
// Represents the next alarm to be delivered.
|
||||||
var alarm alarmer
|
var alarm alarmer
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
// this year's rules for daylight savings time apply to all previous
|
// this year's rules for daylight savings time apply to all previous
|
||||||
// and future years as well.
|
// and future years as well.
|
||||||
|
|
||||||
// TODO(brainman): use GetDynamicTimeZoneInformation, whenever posible (Vista and up),
|
// TODO(brainman): use GetDynamicTimeZoneInformation, whenever possible (Vista and up),
|
||||||
// to improve on situation described in the bug above.
|
// to improve on situation described in the bug above.
|
||||||
|
|
||||||
type zone struct {
|
type zone struct {
|
||||||
@ -46,7 +46,7 @@ func (z *zone) populate(bias, biasdelta int32, d *syscall.Systemtime, name []uin
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre-calculte cutoff time in seconds since the Unix epoch, if data is supplied in "absolute" format.
|
// Pre-calculate cutoff time in seconds since the Unix epoch, if data is supplied in "absolute" format.
|
||||||
func (z *zone) preCalculateAbsSec() {
|
func (z *zone) preCalculateAbsSec() {
|
||||||
if z.year != 0 {
|
if z.year != 0 {
|
||||||
z.abssec = (&Time{z.year, int(z.month), int(z.day), int(z.hour), int(z.minute), int(z.second), 0, 0, ""}).Seconds()
|
z.abssec = (&Time{z.year, int(z.month), int(z.day), int(z.hour), int(z.minute), int(z.second), 0, 0, ""}).Seconds()
|
||||||
@ -55,7 +55,7 @@ func (z *zone) preCalculateAbsSec() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert zone cutoff time to sec in number of seconds since the Unix epoch, given particualar year.
|
// Convert zone cutoff time to sec in number of seconds since the Unix epoch, given particular year.
|
||||||
func (z *zone) cutoffSeconds(year int64) int64 {
|
func (z *zone) cutoffSeconds(year int64) int64 {
|
||||||
// Windows specifies daylight savings information in "day in month" format:
|
// Windows specifies daylight savings information in "day in month" format:
|
||||||
// z.month is month number (1-12)
|
// z.month is month number (1-12)
|
||||||
@ -96,7 +96,7 @@ func (z *zone) isBeforeCutoff(t *Time) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type zoneinfo struct {
|
type zoneinfo struct {
|
||||||
disabled bool // daylight saving time is not used localy
|
disabled bool // daylight saving time is not used locally
|
||||||
offsetIfDisabled int
|
offsetIfDisabled int
|
||||||
januaryIsStd bool // is january 1 standard time?
|
januaryIsStd bool // is january 1 standard time?
|
||||||
std, dst zone
|
std, dst zone
|
||||||
|
@ -29,7 +29,7 @@ var (
|
|||||||
ErrBadWebSocketOrigin = &ProtocolError{"missing or bad WebSocket-Origin"}
|
ErrBadWebSocketOrigin = &ProtocolError{"missing or bad WebSocket-Origin"}
|
||||||
ErrBadWebSocketLocation = &ProtocolError{"missing or bad WebSocket-Location"}
|
ErrBadWebSocketLocation = &ProtocolError{"missing or bad WebSocket-Location"}
|
||||||
ErrBadWebSocketProtocol = &ProtocolError{"missing or bad WebSocket-Protocol"}
|
ErrBadWebSocketProtocol = &ProtocolError{"missing or bad WebSocket-Protocol"}
|
||||||
ErrChallengeResponse = &ProtocolError{"mismatch challange/response"}
|
ErrChallengeResponse = &ProtocolError{"mismatch challenge/response"}
|
||||||
secKeyRandomChars [0x30 - 0x21 + 0x7F - 0x3A]byte
|
secKeyRandomChars [0x30 - 0x21 + 0x7F - 0x3A]byte
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ func handshake(resourceName, host, origin, location, protocol string, br *bufio.
|
|||||||
// Step 25. send CRLF.
|
// Step 25. send CRLF.
|
||||||
bw.WriteString("\r\n")
|
bw.WriteString("\r\n")
|
||||||
|
|
||||||
// Step 26. genearte 8 bytes random key.
|
// Step 26. generate 8 bytes random key.
|
||||||
key3 := generateKey3()
|
key3 := generateKey3()
|
||||||
// Step 27. send it out.
|
// Step 27. send it out.
|
||||||
bw.Write(key3)
|
bw.Write(key3)
|
||||||
@ -262,7 +262,7 @@ func handshake(resourceName, host, origin, location, protocol string, br *bufio.
|
|||||||
return ErrBadWebSocketProtocol
|
return ErrBadWebSocketProtocol
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 42-43. get expected data from challange data.
|
// Step 42-43. get expected data from challenge data.
|
||||||
expected, err := getChallengeResponse(number1, number2, key3)
|
expected, err := getChallengeResponse(number1, number2, key3)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -283,7 +283,7 @@ func handshake(resourceName, host, origin, location, protocol string, br *bufio.
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Handhake described in (soon obsolete)
|
Handshake described in (soon obsolete)
|
||||||
draft-hixie-thewebsocket-protocol-75.
|
draft-hixie-thewebsocket-protocol-75.
|
||||||
*/
|
*/
|
||||||
func draft75handshake(resourceName, host, origin, location, protocol string, br *bufio.Reader, bw *bufio.Writer) (err os.Error) {
|
func draft75handshake(resourceName, host, origin, location, protocol string, br *bufio.Reader, bw *bufio.Writer) (err os.Error) {
|
||||||
|
@ -124,7 +124,7 @@ func (f Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||||||
part1 := keyNumber1 / space1
|
part1 := keyNumber1 / space1
|
||||||
part2 := keyNumber2 / space2
|
part2 := keyNumber2 / space2
|
||||||
|
|
||||||
// Step 8. let challenge to be concatination of part1, part2 and key3.
|
// Step 8. let challenge be concatenation of part1, part2 and key3.
|
||||||
// Step 9. get MD5 fingerprint of challenge.
|
// Step 9. get MD5 fingerprint of challenge.
|
||||||
response, err := getChallengeResponse(part1, part2, key3)
|
response, err := getChallengeResponse(part1, part2, key3)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -158,7 +158,7 @@ func (ws *Conn) SetReadTimeout(nsec int64) os.Error {
|
|||||||
return os.EINVAL
|
return os.EINVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetWritetTimeout sets the connection's network write timeout in nanoseconds.
|
// SetWriteTimeout sets the connection's network write timeout in nanoseconds.
|
||||||
func (ws *Conn) SetWriteTimeout(nsec int64) os.Error {
|
func (ws *Conn) SetWriteTimeout(nsec int64) os.Error {
|
||||||
if conn, ok := ws.rwc.(net.Conn); ok {
|
if conn, ok := ws.rwc.(net.Conn); ok {
|
||||||
return conn.SetWriteTimeout(nsec)
|
return conn.SetWriteTimeout(nsec)
|
||||||
|
Loading…
Reference in New Issue
Block a user