Skip to content

Commit

Permalink
Merge pull request #1 from fiorix/master
Browse files Browse the repository at this point in the history
Optional hexdump by enabling Debug
  • Loading branch information
CodeMonkeyKevin committed Oct 22, 2013
2 parents ad9292c + dc5cad6 commit 296bfc4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions smpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"sync"
)

var Debug bool

type Smpp struct {
mu sync.Mutex
conn net.Conn
Expand Down Expand Up @@ -219,7 +221,9 @@ func (s *Smpp) Read() (Pdu, error) {
}

pkt := append(l, data...)
fmt.Println(hex.Dump(pkt))
if Debug {
fmt.Println(hex.Dump(pkt))
}

pdu, err := ParsePdu(pkt)
if err != nil {
Expand All @@ -232,7 +236,9 @@ func (s *Smpp) Read() (Pdu, error) {
func (s *Smpp) Write(p Pdu) error {
_, err := s.conn.Write(p.Writer())

fmt.Println(hex.Dump(p.Writer()))
if Debug {
fmt.Println(hex.Dump(p.Writer()))
}

return err
}
Expand Down

0 comments on commit 296bfc4

Please sign in to comment.