|
|
@ -2,8 +2,6 @@ package session |
|
|
|
|
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
"io" |
|
|
|
"net" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
) |
|
|
@ -96,17 +94,3 @@ func diff(a, b time.Time) (year, month, day, hour, min, sec int) { |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func isClosed(conn net.Conn) bool { |
|
|
|
conn.SetReadDeadline(time.Now()) |
|
|
|
_, err := conn.Read([]byte{}) |
|
|
|
if err != nil { |
|
|
|
if err == io.EOF { |
|
|
|
conn.Close() |
|
|
|
return true |
|
|
|
} else if strings.Contains(err.Error(), "use of closed network connection") { |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
return false |
|
|
|
} |
|
|
|