forked from forgejo/forgejo
Integrate public as bindata optionally (#293)
* Dropped unused codekit config * Integrated dynamic and static bindata for public * Ignore public bindata * Add a general generate make task * Integrated flexible public assets into web command * Updated vendoring, added all missiong govendor deps * Made the linter happy with the bindata and dynamic code * Moved public bindata definition to modules directory * Ignoring the new bindata path now * Updated to the new public modules import path * Updated public bindata command and drop the new prefix
This commit is contained in:
parent
4680c349dd
commit
b6a95a8cb3
691 changed files with 305318 additions and 1272 deletions
50
vendor/github.com/ngaut/tso/client/conn.go
generated
vendored
Normal file
50
vendor/github.com/ngaut/tso/client/conn.go
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
package client
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/ngaut/deadline"
|
||||
)
|
||||
|
||||
// Conn is the connection for timestamp oracle server, it is not thread safe.
|
||||
type Conn struct {
|
||||
addr string
|
||||
net.Conn
|
||||
closed bool
|
||||
r *bufio.Reader
|
||||
w *bufio.Writer
|
||||
netTimeout time.Duration
|
||||
}
|
||||
|
||||
// NewConnection creates a conn.
|
||||
func NewConnection(addr string, netTimeout time.Duration) (*Conn, error) {
|
||||
conn, err := net.DialTimeout("tcp", addr, netTimeout)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Conn{
|
||||
addr: addr,
|
||||
Conn: conn,
|
||||
r: bufio.NewReaderSize(deadline.NewDeadlineReader(conn, netTimeout), 512*1024),
|
||||
w: bufio.NewWriterSize(deadline.NewDeadlineWriter(conn, netTimeout), 512*1024),
|
||||
netTimeout: netTimeout,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Read reads data and stores it into p.
|
||||
func (c *Conn) Read(p []byte) (int, error) {
|
||||
return c.r.Read(p)
|
||||
}
|
||||
|
||||
// Flush flushs buffered data.
|
||||
func (c *Conn) Flush() error {
|
||||
return c.w.Flush()
|
||||
}
|
||||
|
||||
// Write writes p.
|
||||
func (c *Conn) Write(p []byte) (int, error) {
|
||||
return c.w.Write(p)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue