Skip to content

Commit

Permalink
Deleting commented out code.
Browse files Browse the repository at this point in the history
  • Loading branch information
duoduo committed Mar 22, 2012
1 parent 136bd95 commit 2990321
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 74 deletions.
53 changes: 1 addition & 52 deletions client.go
Expand Up @@ -25,12 +25,6 @@ type Request struct {
}

func NewRequestFromConn(conn net.Conn) {
//n, err := c.Conn.Read(buf[:])
//fmt.Printf("N bytes: ", n)
//fmt.Printf("Buf: %q", buf)
//if err != nil {
//
//}
var request *Request = new(Request)
var lineBuf []byte
var isPrefix bool // isPrefix specifies is line was fully read.
Expand All @@ -43,11 +37,6 @@ func NewRequestFromConn(conn net.Conn) {
}
fmt.Printf("ReadLine: ", lineBuf)
fmt.Printf("ReadLine String: %s", lineBuf)
/*for n, err := reader.Read(readBuf[:]); err == nil {
if n == 0 {
break
}
}*/

// Validate num of args.
argc, err := strconv.ParseUint(string(lineBuf[1:]), 10, 64)
Expand All @@ -73,26 +62,6 @@ func NewRequestFromConn(conn net.Conn) {
line++
}
}

// Loop through num args
//var fullBuf [READ_BUF]byte
//_, _ = reader.Read(fullBuf[:])
//fmt.Printf("ReadLine String FULL: %s", fullBuf)

// Allocate storage
//object := db.NewStringObject()

//

// Redis Unified Request Protocol
/*if query[0] != "*" {
// Err
}
newlinepos := strings.Index(query, "\r")
argc := query[1:newlinepos]
fmt.Printf("NEW LINE POS: %s", newlinepos)
fmt.Printf("ARGC: %s", argc)*/
}

// Client
Expand All @@ -117,16 +86,7 @@ func NewClient(server *Server, db *Db, conn net.Conn) *Client {
}

func (c *Client) ReadRequest() bool {
//var buf [READ_BUF]byte
//n, err := c.Conn.Read(buf[:])
//fmt.Printf("N bytes: ", n)
//fmt.Printf("Buf: %q", buf)
//if err != nil {
//
//}

//query := string(buf[0:n])
//fmt.Printf("Query: %s", query)

var request *Request = new(Request)
var lineBuf []byte
var isPrefix bool // isPrefix specifies is line was fully read.
Expand All @@ -137,13 +97,6 @@ func (c *Client) ReadRequest() bool {
if err != nil || isPrefix || lineBuf[0] != COUNT_BYTE {
return false
}
//fmt.Printf("ReadLine: ", lineBuf)
//fmt.Printf("ReadLine String: %s", lineBuf)
/*for n, err := reader.Read(readBuf[:]); err == nil {
if n == 0 {
break
}
}*/

// Validate num of args.
request.Argc, err = strconv.ParseUint(string(lineBuf[1:]), 10, 64)
Expand All @@ -161,10 +114,7 @@ func (c *Client) ReadRequest() bool {
}

lineBuf, isPrefix, err = reader.ReadLine()
//fmt.Printf("ERROR: ", err)
//fmt.Printf("\n\nBufLength: %d Line %d: %s", len(lineBuf), line, lineBuf)
if lineBuf[0] != ARG_BYTE {
//fmt.Printf("Setting ARGV%s", line)
request.Argv[line] = lineBuf
// New line if isPrefix == false
if !isPrefix {
Expand All @@ -173,7 +123,6 @@ func (c *Client) ReadRequest() bool {
}
}

//fmt.Printf("\n\nREQUEST DUMP: %+v", request)
c.Request = request
return true
}
Expand Down
5 changes: 0 additions & 5 deletions red.go
Expand Up @@ -23,11 +23,6 @@ func main() {
log.Fatal(err)
}
pprof.StartCPUProfile(f)
/*go func() {
time.Sleep(9e9)
pprof.StopCPUProfile()
os.Exit(0)
}()*/
}

db := NewDb()
Expand Down
18 changes: 1 addition & 17 deletions server.go
Expand Up @@ -33,7 +33,6 @@ func (s *Server) Start() {

// Listen
fmt.Printf("Listening on port 6380\n")
// fmt.Printf("value or whatev: ", listener)
for {
// var read = true
conn, err := listener.Accept()
Expand All @@ -43,14 +42,6 @@ func (s *Server) Start() {
}

//fmt.Printf("New connection from: %s\n", conn.RemoteAddr())

// Launch some go routine with connection
//fmt.Printf("NewConnFromStart: ", conn)
//fmt.Printf("NewConnFromStartWithPointer: ", &conn)
//go func() {
// c := NewClient(s, s.Db, conn)
// c.Response.Pong()
//}()
go s.handleConn(conn, mainCh)
}
}
Expand All @@ -60,14 +51,7 @@ func (s *Server) Stop() {
os.Exit(0)
}

func (s *Server) handleConn(conn net.Conn, mainCh chan int) {
//fmt.Printf("NewConnFromCreateClient: ", conn)

func (s *Server) handleConn(conn net.Conn, mainCh chan int) {
c := NewClient(s, s.Db, conn)
//fmt.Printf("NewClient: ", c)

// c.InjectDb(db)

c.ProcessRequest(mainCh)
//fmt.Printf("Client DUMP: %#v", c)
}

0 comments on commit 2990321

Please sign in to comment.