commit
6b376e3522
4 changed files with 11 additions and 16 deletions
|
@ -1,6 +0,0 @@
|
|||
# This is the official list of Chihaya contributors, in alphabetical order.
|
||||
|
||||
Jimmy Zelinskie <jimmyzelinskie@gmail.com>
|
||||
Josh de Kock <josh@itanimul.li>
|
||||
Justin Li <jli@j-li.net>
|
||||
Leo Balduf <balduf@hm.edu>
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
[![Build Status](https://api.travis-ci.org/chihaya/chihaya.svg?branch=master)](https://travis-ci.org/chihaya/chihaya)
|
||||
[![Docker Repository on Quay.io](https://quay.io/repository/jzelinskie/chihaya/status "Docker Repository on Quay.io")](https://quay.io/repository/jzelinskie/chihaya)
|
||||
[![Go Report Card](https://goreportcard.com/badge/github.com/chihaya/chihaya)](https://goreportcard.com/report/github.com/chihaya/chihaya)
|
||||
[![GoDoc](https://godoc.org/github.com/chihaya/chihaya?status.svg)](https://godoc.org/github.com/chihaya/chihaya)
|
||||
[![License](https://img.shields.io/badge/license-BSD-blue.svg)](https://en.wikipedia.org/wiki/BSD_licenses#2-clause_license_.28.22Simplified_BSD_License.22_or_.22FreeBSD_License.22.29)
|
||||
[![IRC Channel](https://img.shields.io/badge/freenode-%23chihaya-blue.svg "IRC Channel")](http://webchat.freenode.net/?channels=chihaya)
|
||||
|
|
|
@ -62,7 +62,7 @@ func TestParseValidURLData(t *testing.T) {
|
|||
}
|
||||
|
||||
if !mapArrayEqual(parseVal, parsedQueryObj.params) {
|
||||
t.Fatalf("Incorrect parse at item %d.\n Expected=%v\n Recieved=%v\n", parseIndex, parseVal, parsedQueryObj.params)
|
||||
t.Fatalf("Incorrect parse at item %d.\n Expected=%v\n Received=%v\n", parseIndex, parseVal, parsedQueryObj.params)
|
||||
}
|
||||
|
||||
if parsedQueryObj.path != "/announce" {
|
||||
|
|
|
@ -24,14 +24,14 @@ type Stopper interface {
|
|||
// The channel can either return one error or be closed. Closing the
|
||||
// channel signals a clean shutdown.
|
||||
// The Stop function should return immediately and perform the actual
|
||||
// shutdown in a seperate goroutine.
|
||||
// shutdown in a separate goroutine.
|
||||
Stop() <-chan error
|
||||
}
|
||||
|
||||
// StopGroup is a group that can be stopped.
|
||||
type StopGroup struct {
|
||||
stoppables []Func
|
||||
stoppablesLock sync.Mutex
|
||||
stoppables []Func
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
// Func is a function that can be used to provide a clean shutdown.
|
||||
|
@ -47,8 +47,8 @@ func NewStopGroup() *StopGroup {
|
|||
// Add adds a Stopper to the StopGroup.
|
||||
// On the next call to Stop(), the Stopper will be stopped.
|
||||
func (cg *StopGroup) Add(toAdd Stopper) {
|
||||
cg.stoppablesLock.Lock()
|
||||
defer cg.stoppablesLock.Unlock()
|
||||
cg.Lock()
|
||||
defer cg.Unlock()
|
||||
|
||||
cg.stoppables = append(cg.stoppables, toAdd.Stop)
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ func (cg *StopGroup) Add(toAdd Stopper) {
|
|||
// AddFunc adds a Func to the StopGroup.
|
||||
// On the next call to Stop(), the Func will be called.
|
||||
func (cg *StopGroup) AddFunc(toAddFunc Func) {
|
||||
cg.stoppablesLock.Lock()
|
||||
defer cg.stoppablesLock.Unlock()
|
||||
cg.Lock()
|
||||
defer cg.Unlock()
|
||||
|
||||
cg.stoppables = append(cg.stoppables, toAddFunc)
|
||||
}
|
||||
|
@ -67,8 +67,8 @@ func (cg *StopGroup) AddFunc(toAddFunc Func) {
|
|||
// The slice of errors returned contains all errors returned by stopping the
|
||||
// members.
|
||||
func (cg *StopGroup) Stop() []error {
|
||||
cg.stoppablesLock.Lock()
|
||||
defer cg.stoppablesLock.Unlock()
|
||||
cg.Lock()
|
||||
defer cg.Unlock()
|
||||
|
||||
var errors []error
|
||||
whenDone := make(chan struct{})
|
||||
|
|
Loading…
Reference in a new issue