Skip to content

Commit

Permalink
Merge pull request #3 from forcedotcom/mf/fixEnabled
Browse files Browse the repository at this point in the history
Mf/fix enabled
  • Loading branch information
mikemfrank committed May 14, 2015
2 parents a1df538 + c3b59d6 commit 605b1b1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ _testmain.go


.idea
*.iml
6 changes: 3 additions & 3 deletions connection/connection_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
package connection

import (
"github.com/forcedotcom/rmux/protocol"
// "github.com/forcedotcom/rmux/protocol"
"time"
)

Expand Down Expand Up @@ -85,12 +85,12 @@ func (myConnectionPool *ConnectionPool) CheckConnectionState() bool {
myConnection := myConnectionPool.GetConnection()
//If we failed to bind, or if our PING fails, abort
if myConnection != nil && myConnection.CheckConnection() {
protocol.Debug("The pool is up\r\n")
// protocol.Debug("The pool is up\r\n")
myConnectionPool.IsConnected = true
myConnectionPool.RecycleRemoteConnection(myConnection)
return true
} else {
protocol.Debug("The pool is down\r\n")
// protocol.Debug("The pool is down\r\n")
myConnectionPool.IsConnected = false
for {
//drain all the connections
Expand Down
16 changes: 8 additions & 8 deletions protocol/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func IsSupportedFunction(command [20]byte, commandLength int, isMultiplexing, is
return false
}
//supported if multiplexing is disabled: script, sdiff, sdiffstore, sinter, sinterstore, smove, sunion, sunionstore
if isMultiplexing {
if !isMultiplexing {
return true
}
//supported: scard
Expand Down Expand Up @@ -371,31 +371,31 @@ func GetCommand(source *bufio.Reader, command, firstArgument []byte) (commandLen
func FlushLine(line []byte, destination *bufio.Writer) (err error) {
err = writeLine(line, destination)
if err != nil {
Debug("FlushLine: Error received from writeLine: %s", err)
// Debug("FlushLine: Error received from writeLine: %s", err)
return
}
startTime := time.Now()
// startTime := time.Now()
err = destination.Flush()
Debug("FlushLine: Time to flush: %s\r\n", time.Since(startTime))
// Debug("FlushLine: Time to flush: %s\r\n", time.Since(startTime))
return
}

//Writes the given line to the buffer, followed by a GO_NEWLINE
//Does not explicitly flush the buffer. Final lines in a sequence should be followed by FlushLine
func writeLine(line []byte, destination *bufio.Writer) (err error) {
startTime := time.Now()
// startTime := time.Now()
_, err = destination.Write(line)
if err != nil {
Debug("writeLine: Error received from write: %s", err)
// Debug("writeLine: Error received from write: %s", err)
return
}

_, err = destination.Write(REDIS_NEWLINE)
if err != nil {
Debug("writeLine: Error received from writing GO_NEWLINE: %s", err)
// Debug("writeLine: Error received from writing GO_NEWLINE: %s", err)
return
}
Debug("writeLine: Time to write line: %s\r\n", time.Since(startTime))
// Debug("writeLine: Time to write line: %s\r\n", time.Since(startTime))
return
}

Expand Down
4 changes: 2 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ func (myRedisMultiplexer *RedisMultiplexer) maintainConnectionStates() {
for myRedisMultiplexer.active {
myRedisMultiplexer.activeConnectionCount = myRedisMultiplexer.countActiveConnections()
myRedisMultiplexer.refreshSubscriptions()
protocol.Debug("We have %d connections\r\n", myRedisMultiplexer.connectionCount)
// protocol.Debug("We have %d connections\r\n", myRedisMultiplexer.connectionCount)
runtime.ReadMemStats(&m)
protocol.Debug("Memory profile: InUse(%d) Idle (%d) Released(%d)\n", m.HeapInuse, m.HeapIdle, m.HeapReleased)
// protocol.Debug("Memory profile: InUse(%d) Idle (%d) Released(%d)\n", m.HeapInuse, m.HeapIdle, m.HeapReleased)
myRedisMultiplexer.generateMultiplexInfo()
time.Sleep(100 * time.Millisecond)
}
Expand Down

0 comments on commit 605b1b1

Please sign in to comment.