Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
snail007 committed Oct 9, 2018
1 parent 6babe1e commit 325acb2
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion core/dst/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (c *Conn) start() {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:", e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s", e, string(debug.Stack()))
}
}()
c.reader()
Expand Down
12 changes: 6 additions & 6 deletions core/lib/mapx/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (m ConcurrentMap) Iter() <-chan Tuple {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
fanIn(chans, ch)
Expand All @@ -174,7 +174,7 @@ func (m ConcurrentMap) IterBuffered() <-chan Tuple {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
fanIn(chans, ch)
Expand All @@ -195,7 +195,7 @@ func snapshot(m ConcurrentMap) (chans []chan Tuple) {
go func(index int, shard *ConcurrentMapShared) {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
// Foreach key, value pair.
Expand All @@ -221,7 +221,7 @@ func fanIn(chans []chan Tuple, out chan Tuple) {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
func(ch chan Tuple) {
Expand Down Expand Up @@ -274,7 +274,7 @@ func (m ConcurrentMap) Keys() []string {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
// Foreach shard.
Expand All @@ -284,7 +284,7 @@ func (m ConcurrentMap) Keys() []string {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
func(shard *ConcurrentMapShared) {
Expand Down
8 changes: 4 additions & 4 deletions core/lib/udp/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (s *IOBinder) AliveWithServeConn(srcAddr string, inTCPConn *net.Conn) *IOBi
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
buf := make([]byte, 1)
Expand All @@ -75,7 +75,7 @@ func (s *IOBinder) AliveWithServeConn(srcAddr string, inTCPConn *net.Conn) *IOBi
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
for {
Expand All @@ -96,7 +96,7 @@ func (s *IOBinder) AliveWithClientConn(srcAddr string, outTCPConn *net.Conn) *IO
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
buf := make([]byte, 1)
Expand Down Expand Up @@ -156,7 +156,7 @@ func (s *IOBinder) Run() (err error) {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
defer func() {
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func Clean(s *services.Service) {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s", e, string(debug.Stack()))
}
}()
for _ = range signalChan {
Expand Down
2 changes: 1 addition & 1 deletion services/socks/socks.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (s *Socks) InitService() (err error) {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:", e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s", e, string(debug.Stack()))
}
}()
//循环检查ssh网络连通性
Expand Down
12 changes: 6 additions & 6 deletions services/tunnel/tunnel_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (s *TunnelClient) Start(args interface{}, log *logger.Logger) (err error) {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
s.ServeUDP(localAddr, ID, serverID)
Expand All @@ -168,7 +168,7 @@ func (s *TunnelClient) Start(args interface{}, log *logger.Logger) (err error) {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
s.ServeConn(localAddr, ID, serverID)
Expand Down Expand Up @@ -324,7 +324,7 @@ func (s *TunnelClient) ServeUDP(localAddr, ID, serverID string) {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
(*item).udpConn.Write(body)
Expand All @@ -335,7 +335,7 @@ func (s *TunnelClient) UDPRevecive(key, ID string) {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
s.log.Printf("udp conn %s connected", ID)
Expand Down Expand Up @@ -365,7 +365,7 @@ func (s *TunnelClient) UDPRevecive(key, ID string) {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
(*cui.conn).SetWriteDeadline(time.Now().Add(time.Millisecond * time.Duration(*s.cfg.Timeout)))
Expand All @@ -384,7 +384,7 @@ func (s *TunnelClient) UDPGCDeamon() {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
if s.isStop {
Expand Down
6 changes: 3 additions & 3 deletions services/tunnel/tunnel_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func (s *TunnelServer) UDPGCDeamon() {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:", e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s", e, string(debug.Stack()))
}
}()
if s.isStop {
Expand Down Expand Up @@ -440,7 +440,7 @@ func (s *TunnelServer) UDPRevecive(key, ID string) {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:", e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s", e, string(debug.Stack()))
}
}()
s.log.Printf("udp conn %s connected", ID)
Expand Down Expand Up @@ -473,7 +473,7 @@ func (s *TunnelServer) UDPRevecive(key, ID string) {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:", e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s", e, string(debug.Stack()))
}
}()
s.sc.UDPListener.WriteToUDP(body, uc.srcAddr)
Expand Down
12 changes: 6 additions & 6 deletions services/udp/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (s *UDP) OutToUDPGCDeamon() {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:", e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s", e, string(debug.Stack()))
}
}()
if s.isStop {
Expand Down Expand Up @@ -216,7 +216,7 @@ func (s *UDP) OutToUDP(packet []byte, localAddr, srcAddr *net.UDPAddr) {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:", e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s", e, string(debug.Stack()))
}
}()
s.log.Printf("udp conn %s <--> %s connected", srcAddr.String(), localAddr.String())
Expand All @@ -238,7 +238,7 @@ func (s *UDP) OutToUDP(packet []byte, localAddr, srcAddr *net.UDPAddr) {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:", e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s", e, string(debug.Stack()))
}
}()
(*(s.sc).UDPListener).SetWriteDeadline(time.Now().Add(time.Millisecond * time.Duration(*s.cfg.Timeout)))
Expand Down Expand Up @@ -275,7 +275,7 @@ func (s *UDP) UDPGCDeamon() {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:", e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s", e, string(debug.Stack()))
}
}()
if s.isStop {
Expand Down Expand Up @@ -352,7 +352,7 @@ func (s *UDP) UDPRevecive(key string) {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:", e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s", e, string(debug.Stack()))
}
}()
s.log.Printf("udp conn %s connected", key)
Expand Down Expand Up @@ -385,7 +385,7 @@ func (s *UDP) UDPRevecive(key string) {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:", e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s", e, string(debug.Stack()))
}
}()
s.sc.UDPListener.WriteToUDP(body, uc.srcAddr)
Expand Down
4 changes: 2 additions & 2 deletions utils/lb/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (b *Backend) startMuxHeartCheck() {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
for {
Expand Down Expand Up @@ -151,7 +151,7 @@ func (b *Backend) startTCPHeartCheck() {
go func() {
defer func() {
if e := recover(); e != nil {
fmt.Printf("crashed, err: %s\nstack:",e, string(debug.Stack()))
fmt.Printf("crashed, err: %s\nstack:\n%s",e, string(debug.Stack()))
}
}()
for {
Expand Down

0 comments on commit 325acb2

Please sign in to comment.