NetCoreServer icon indicating copy to clipboard operation
NetCoreServer copied to clipboard

Add session last read and write activity timestamps

Open TailyFair opened this issue 3 years ago • 2 comments

After discussion in https://github.com/chronoxor/NetCoreServer/issues/98 it was concluded, that adding dangling connections detection is out of scope of core library and should be implemented in application layer.

To implement detection of idling connections, checking session last activity is required.

It would be helpful to have LastBytesReceived that shows DateTime of last bytes received and LastBytesSent that shows DateTime of last bytes sent fields in TcpSession, SslSession to easily check when was last IO operation executed in particular session so they could be checked against idling session logic.

I could prepare PR if @chronoxor agrees with this.

TailyFair avatar Dec 07 '20 15:12 TailyFair

@chronoxor what do you think about this suggestion?

TailyFair avatar Feb 11 '21 08:02 TailyFair

I think this can be easily done in your code by inheriting onSend()/onReceive() methods in TcpSession/SslSession.

I'll try to implement it in base sessions soon.

chronoxor avatar Feb 11 '21 12:02 chronoxor