forked from External/ergo
Merge pull request #218 from slingamn/socketwriter.1
refactor irc.Socket
This commit is contained in:
commit
7cfa75a59e
6 changed files with 90 additions and 125 deletions
|
|
@ -87,7 +87,9 @@ type Client struct {
|
|||
// NewClient returns a client with all the appropriate info setup.
|
||||
func NewClient(server *Server, conn net.Conn, isTLS bool) *Client {
|
||||
now := time.Now()
|
||||
socket := NewSocket(conn, server.MaxSendQBytes)
|
||||
limits := server.Limits()
|
||||
fullLineLenLimit := limits.LineLen.Tags + limits.LineLen.Rest
|
||||
socket := NewSocket(conn, fullLineLenLimit*2, server.MaxSendQBytes())
|
||||
go socket.RunSocketWriter()
|
||||
client := &Client{
|
||||
atime: now,
|
||||
|
|
@ -253,7 +255,11 @@ func (client *Client) run() {
|
|||
|
||||
line, err = client.socket.Read()
|
||||
if err != nil {
|
||||
client.Quit("connection closed")
|
||||
quitMessage := "connection closed"
|
||||
if err == errReadQ {
|
||||
quitMessage = "readQ exceeded"
|
||||
}
|
||||
client.Quit(quitMessage)
|
||||
break
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue