Skip to content

Commit

Permalink
Make malus compile again
Browse files Browse the repository at this point in the history
  • Loading branch information
distributed committed Jun 30, 2010
1 parent 8fae5a4 commit 6ef9e92
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func find(t string, cm *CallManager, rt RoutingTable, bootstrap *RTHostList) *RT
}

if kclosest.Len() == 0 {
panicln("nobody to ask...")
panic("nobody to ask...\n")
}

kclosest.Sort()
Expand All @@ -148,7 +148,7 @@ func find(t string, cm *CallManager, rt RoutingTable, bootstrap *RTHostList) *RT
for converging || finishing {
switch {
case converging && finishing:
panicln("find logic error")
panic("find logic error\n")
case converging:
fmt.Printf("find: convering round\n")
case finishing:
Expand Down
7 changes: 3 additions & 4 deletions lib/utility.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package malus

import (
"crypto/sha1"
"strings"
"encoding/hex"
)

Expand Down Expand Up @@ -32,7 +31,7 @@ func SHA1Bytes(b []byte) string {
// Hashes a string and returns a 20 byte string.
func SHA1String(s string) string {
h := sha1.New()
h.Write(strings.Bytes(s))
h.Write([]byte(s))
return string(h.Sum())
}

Expand Down Expand Up @@ -80,7 +79,7 @@ func BucketNo(d Distance) uint {

func (a Distance) Less(b Distance) bool {
if len(a) != len(b) {
panicln("comparing distances of different lengths")
panic("comparing distances of different lengths\n")
}

//fmt.Printf("distance Less called: %v < %v\n", a, b)
Expand All @@ -102,5 +101,5 @@ func (a Distance) Less(b Distance) bool {
}

func FarthestNode(oid string) string {
return string(XOR(oid, MaxId))
return string([]byte(XOR(oid, MaxId)))
}
5 changes: 2 additions & 3 deletions lib/webinterface.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package malus

import (
"http"
"strings"
"fmt"
"os"
"net"
Expand Down Expand Up @@ -61,7 +60,7 @@ func (wi *WebInterface) getDummy() (func(*http.Conn, *http.Request)) {
fmt.Fprintf(c, "<tt>\n")
switch req.FormValue("rpc") {
case "ping":
c.Write(strings.Bytes("pinging... <br>"))
c.Write([]byte("pinging... <br>"))
retis, err := wi.cm.Call(raddr, "ping", make([]interface{}, 0))
fmt.Fprintf(c, "=> ping done! err %v retis %v\n", err, retis)
case "getsocket":
Expand Down Expand Up @@ -100,7 +99,7 @@ func (wi *WebInterface) getDummy() (func(*http.Conn, *http.Request)) {
fmt.Fprintf(c, "stats: %v<br>\n", stats)
fmt.Fprintf(c, "=&gt; %d kbyte alloc / %d kbyte sys<br>\n", stats.Alloc / 1024, stats.Sys / 1024)
default:
c.Write(strings.Bytes("das esch de rap shit: " + req.FormValue("rpc") + "<br> <a href=\"?rpc=ping\">ping now!</a><br>"))
c.Write([]byte("das esch de rap shit: " + req.FormValue("rpc") + "<br> <a href=\"?rpc=ping\">ping now!</a><br>"))
fmt.Fprintf(c, "fuck\n")
case "find":
wi.find(c, req)
Expand Down
2 changes: 1 addition & 1 deletion main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func main() {

laddr, err := net.ResolveUDPAddr("0.0.0.0:7000")
if err != nil {
panicln("could not resolve addr")
panic("could not resolve addr\n")
}
tr := malus.NewUDPTransceiver("udp", laddr)
if tr == nil {
Expand Down

0 comments on commit 6ef9e92

Please sign in to comment.