Fuzz testing callbacks
This commit is contained in:
parent
8b3e6a50ac
commit
c47f9d8e3d
9
irc.go
9
irc.go
@ -89,8 +89,10 @@ func (irc *Connection) readLoop() {
|
|||||||
// +build gofuzz
|
// +build gofuzz
|
||||||
func Fuzz(data []byte) int {
|
func Fuzz(data []byte) int {
|
||||||
b := bytes.NewBuffer(data)
|
b := bytes.NewBuffer(data)
|
||||||
err, _ := parseToEvent(b.String())
|
event, err := parseToEvent(b.String())
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
irc := IRC("go-eventirc", "go-eventirc")
|
||||||
|
irc.RunCallbacks(event)
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
@ -351,9 +353,12 @@ func (irc *Connection) Disconnect() {
|
|||||||
for event := range irc.events {
|
for event := range irc.events {
|
||||||
irc.ClearCallback(event)
|
irc.ClearCallback(event)
|
||||||
}
|
}
|
||||||
|
if irc.end != nil {
|
||||||
close(irc.end)
|
close(irc.end)
|
||||||
|
}
|
||||||
|
if irc.pwrite != nil {
|
||||||
close(irc.pwrite)
|
close(irc.pwrite)
|
||||||
|
}
|
||||||
|
|
||||||
irc.Wait()
|
irc.Wait()
|
||||||
irc.socket.Close()
|
irc.socket.Close()
|
||||||
|
Loading…
Reference in New Issue
Block a user