JKRhb / dtls2

A DTLS library for Dart based on OpenSSL.
MIT License
3 stars 0 forks source link

Check bytesSent at every invocation of _maintainOutgoing() and if 0 throw Network Unreachable #74

Closed Ifilehk closed 1 year ago

Ifilehk commented 1 year ago

Hello Jan

Back again with an issue. Getting a network unreachable unhandled exception during a _dtlsClient._socket.send in dtls_client.dart _maintainOutgoing() line 559.

I suppose that every _maintainOutgoing() invocation has to be checked on the number of sent bytes and throw Network unreachable consequently.

Server side might need the same ...

JKRhb commented 1 year ago

Hi @Ifilehk, welcome back and thank you for reporting this issue!

I suppose that every _maintainOutgoing() invocation has to be checked on the number of sent bytes and throw Network unreachable consequently.

So would you suggest that a SocketException should be thrown if the number of bytes sent is equal to 0? Or would another behavior be better here?

Ifilehk commented 1 year ago

I think that the answer should be an exception + connection close and cleanings because for what ever reason the network adapter has been deactivated. So no reason to continue with the current connection.

JKRhb commented 1 year ago

Hi @Ifilehk, sorry for the delay! I tried to come up with a fix in #75, could you try out if that resolves the issue?

Ifilehk commented 1 year ago

No problem !!!

Will give a try and let you know

Ifilehk commented 1 year ago

Here my comments:

On client side: A Exception: DtlsException: Sending failed: Not connected is thrown. I would expect a SocketException Network unreachable. Otherwise behavior seems to be OK.

On server side: On Ubuntu, unfortunately the invocation of _dtlsServer._socket.send doesn't return 0 on Network unreachable. The app crashes with the system exception Network unreachable without possibility to catch it.

Will open an issue there to have at least the same behavior seen on Android.

JKRhb commented 1 year ago

Thank you for your feedback!

On client side: A Exception: DtlsException: Sending failed: Not connected is thrown. I would expect a SocketException > Network unreachable. Otherwise behavior seems to be OK.

I will update #75 accordingly :)

On server side: On Ubuntu, unfortunately the invocation of _dtlsServer._socket.send doesn't return 0 on Network unreachable. The app crashes with the system exception Network unreachable without possibility to catch it.

Will open an issue there to have at least the same behavior seen on Android.

Hmm, okay, so there is no potential to fix it here, right?

Ifilehk commented 1 year ago

Your fix is already there and you can not make more at this point. Let's see if the flutter team will do something.

On Apr 26, 2023, 18:54, at 18:54, Jan Romann @.***> wrote:

Thank you for your feedback!

On client side: A Exception: DtlsException: Sending failed: Not connected is thrown. I would expect a SocketException > Network unreachable. Otherwise behavior seems to be OK.

I will update #75 accordingly :)

On server side: On Ubuntu, unfortunately the invocation of _dtlsServer._socket.send doesn't return 0 on Network unreachable. The app crashes with the system exception Network unreachable without possibility to catch it.

Will open an issue there to have at least the same behavior seen on Android.

Hmm, okay, so there is no potential to fix it here, right?

-- Reply to this email directly or view it on GitHub: https://github.com/JKRhb/dtls2/issues/74#issuecomment-1523828032 You are receiving this because you were mentioned.

Message ID: @.***>

Ifilehk commented 1 year ago

Will let you know

On Apr 23, 2023, 11:47, at 11:47, Jan Romann @.***> wrote:

Hi @Ifilehk, sorry for the delay! I tried to come up with a fix in #75, could you try out if that resolves the issue?

-- Reply to this email directly or view it on GitHub: https://github.com/JKRhb/dtls2/issues/74#issuecomment-1519031018 You are receiving this because you were mentioned.

Message ID: @.***>

JKRhb commented 1 year ago

A Exception: DtlsException: Sending failed: Not connected is thrown. I would expect a SocketException Network unreachable. Otherwise behavior seems to be OK.

Hmm, on second thought, for this exception, I think the current behavior does make sense since this exception is only thrown if the connection has not been established or has been closed. Or would you say that there should be a further differentiation?