mirror of https://github.com/cbeuw/Cloak
Logging for silent connections
This commit is contained in:
parent
8d84ebd145
commit
402cfc9e25
|
|
@ -32,7 +32,9 @@ func dispatchConnection(conn net.Conn, sta *server.State) {
|
|||
conn.SetReadDeadline(time.Now().Add(3 * time.Second))
|
||||
i, err := io.ReadAtLeast(conn, buf, 1)
|
||||
if err != nil {
|
||||
go conn.Close()
|
||||
log.WithField("remoteAddr", remoteAddr).
|
||||
Infof("failed to read anything after connection is established: %v", err)
|
||||
conn.Close()
|
||||
return
|
||||
}
|
||||
conn.SetReadDeadline(time.Time{})
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ func (sb *switchboard) closeAll() {
|
|||
|
||||
// deplex function costantly reads from a TCP connection
|
||||
func (sb *switchboard) deplex(connId uint32, conn net.Conn) {
|
||||
defer conn.Close()
|
||||
buf := make([]byte, 20480)
|
||||
for {
|
||||
n, err := sb.session.UnitRead(conn, buf)
|
||||
|
|
@ -159,7 +160,6 @@ func (sb *switchboard) deplex(connId uint32, conn net.Conn) {
|
|||
sb.Valve.AddRx(int64(n))
|
||||
if err != nil {
|
||||
log.Debugf("a connection for session %v has closed: %v", sb.session.id, err)
|
||||
go conn.Close()
|
||||
sb.close("a connection has dropped unexpectedly")
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue