Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions janus.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (gateway *Gateway) send(msg map[string]interface{}, transaction chan interf

data, err := json.Marshal(msg)
if err != nil {
fmt.Printf("json.Marshal: %s\n", err)
log.Printf("json.Marshal: %s\n", err)
return
}

Expand All @@ -112,7 +112,7 @@ func (gateway *Gateway) send(msg map[string]interface{}, transaction chan interf
select {
case gateway.errors <- err:
default:
fmt.Printf("conn.Write: %s\n", err)
log.Printf("conn.Write: %s\n", err)
}

return
Expand Down Expand Up @@ -160,14 +160,14 @@ func (gateway *Gateway) recv() {
select {
case gateway.errors <- err:
default:
fmt.Printf("conn.Read: %s\n", err)
log.Printf("conn.Read: %s\n", err)
}

return
}

if err := json.Unmarshal(data, &base); err != nil {
fmt.Printf("json.Unmarshal: %s\n", err)
log.Printf("json.Unmarshal: %s\n", err)
continue
}

Expand All @@ -181,13 +181,13 @@ func (gateway *Gateway) recv() {

typeFunc, ok := msgtypes[base.Type]
if !ok {
fmt.Printf("Unknown message type received!\n")
log.Printf("Unknown message type received!\n")
continue
}

msg := typeFunc()
if err := json.Unmarshal(data, &msg); err != nil {
fmt.Printf("json.Unmarshal: %s\n", err)
log.Printf("json.Unmarshal: %s\n", err)
continue // Decode error
}

Expand All @@ -211,7 +211,7 @@ func (gateway *Gateway) recv() {
session := gateway.Sessions[base.Session]
gateway.Unlock()
if session == nil {
fmt.Printf("Unable to deliver message. Session gone?\n")
log.Printf("Unable to deliver message. Session gone?\n")
continue
}

Expand All @@ -220,7 +220,7 @@ func (gateway *Gateway) recv() {
handle := session.Handles[base.Handle]
session.Unlock()
if handle == nil {
fmt.Printf("Unable to deliver message. Handle gone?\n")
log.Printf("Unable to deliver message. Handle gone?\n")
continue
}

Expand Down