Add in flush map, remove bufio reader

This commit is contained in:
Derek Collison
2012-11-20 13:09:07 -08:00
parent 640bd8d2ba
commit 30883c7c37

View File

@@ -117,9 +117,12 @@ func (s *Server) createClient(conn net.Conn) *client {
c := &client{srv: s, conn: conn}
c.cid = atomic.AddUint64(&s.gcid, 1)
c.bw = bufio.NewWriterSize(c.conn, defaultBufSize)
c.br = bufio.NewReaderSize(c.conn, defaultBufSize)
c.subs = hashmap.New()
// This is to track pending clients that have data to be flushed
// after we process inbound msgs from our own connection.
c.pcd = make(map[*client]struct{})
if ip, ok := conn.(*net.TCPConn); ok {
ip.SetReadBuffer(32768)
}