Update evio

This commit is contained in:
tidwall 2018-11-05 12:07:18 -07:00
parent e46c945f2c
commit 0cd6d164d6
3 changed files with 17 additions and 14 deletions

6
Gopkg.lock generated
View File

@ -231,15 +231,15 @@
revision = "b67b1b8c1658cb01502801c14e33c61e6c4cbb95"
[[projects]]
digest = "1:8aa59623aefb49c419e5b24179583e41df4b8c2f6a567f2cb8156a78a32e554a"
digest = "1:1f7026c4840ae2a06e892ffcad5a36416de0a7e5be33ce65449435fd8f15414b"
name = "github.com/tidwall/evio"
packages = [
".",
"internal",
]
pruneopts = ""
revision = "3a190d6d209c66b1fee96ee3db9e70c71e3635d5"
version = "v1.0.0"
revision = "ea610eff86981249be649bbdcedbf409a2db2173"
version = "v1.0.1"
[[projects]]
branch = "master"

View File

@ -9,17 +9,9 @@
`evio` is an event loop networking framework that is fast and small. It makes direct [epoll](https://en.wikipedia.org/wiki/Epoll) and [kqueue](https://en.wikipedia.org/wiki/Kqueue) syscalls rather than using the standard Go [net](https://golang.org/pkg/net/) package, and works in a similar manner as [libuv](https://github.com/libuv/libuv) and [libevent](https://github.com/libevent/libevent).
The goal of this project is to create a server framework for Go that performs on par with [Redis](http://redis.io) and [Haproxy](http://www.haproxy.org) for packet handling. My hope is to use this as a foundation for [Tile38](https://github.com/tidwall/tile38) and a future L7 proxy for Go... and a bunch of other stuff.
The goal of this project is to create a server framework for Go that performs on par with [Redis](http://redis.io) and [Haproxy](http://www.haproxy.org) for packet handling. It was built to be the foundation for [Tile38](https://github.com/tidwall/tile38) and a future L7 proxy for Go.
**Just to be perfectly clear**
This project is not intended to be a general purpose replacement for the standard Go net package or goroutines. It's for building specialized services such as key value stores, L7 proxies, static websites, etc.
You would not want to use this framework if you need to handle long-running requests (milliseconds or more). For example, a web api that needs to connect to a mongo database, authenticate, and respond; just use the Go net/http package instead.
There are many popular event loop based applications in the wild such as Nginx, Haproxy, Redis, and Memcached. All of these are very fast and written in C.
The reason I wrote this framework is so that I can build certain networking services that perform like the C apps above, but I also want to continue to work in Go.
*Please note: Evio should not be considered as a drop-in replacement for the standard Go net or net/http packages.*
## Features

View File

@ -7,6 +7,7 @@
package evio
import (
"io"
"net"
"os"
"runtime"
@ -458,7 +459,17 @@ func (c *detachedConn) Close() error {
}
func (c *detachedConn) Read(p []byte) (n int, err error) {
return syscall.Read(c.fd, p)
n, err = syscall.Read(c.fd, p)
if err != nil {
return n, err
}
if n == 0 {
if len(p) == 0 {
return 0, nil
}
return 0, io.EOF
}
return n, nil
}
func (c *detachedConn) Write(p []byte) (n int, err error) {