Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 19 11:01
  • Feb 23 10:46
    kotelnik closed #462
  • Feb 23 10:46
    kotelnik commented #462
  • Feb 23 00:58
    kpp commented #462
  • Feb 22 21:41
    kotelnik commented #462
  • Feb 21 13:42
    kpp commented #462
  • Feb 21 11:18
    kotelnik edited #462
  • Feb 21 11:17
    kotelnik opened #462
  • Feb 17 09:43
  • Feb 10 17:26
    dependabot[bot] labeled #1
  • Feb 10 17:26
    dependabot[bot] opened #1
  • Feb 10 17:26

    dependabot[bot] on npm_and_yarn

    Bump node-sass from 4.11.0 to 7… (compare)

  • Nov 19 2021 08:26
    coveralls commented #461
  • Nov 19 2021 08:17
    kurnevsky synchronize #461
  • Nov 19 2021 08:17

    kurnevsky on dht_state

    refactor(dht): introduce a sing… (compare)

  • Nov 13 2021 13:08
    kurnevsky commented #459
  • Nov 13 2021 12:44
    kpp commented #459
  • Nov 13 2021 08:17
    coveralls commented #461
  • Nov 13 2021 08:10
    kurnevsky opened #461
  • Nov 13 2021 08:10

    kurnevsky on dht_state

    refactor(dht): introduce a sing… (compare)

Cho
@NamsooCho
Nom5.0 has a concept of unrecoverable error, it means that nom can’t continue parsing, so terminating process or thread is needed.
but this means that we must have a point for DoS attack.
How should we handle this unrecoverable error?
inosms
@inosms
The article is great, haven't seen this one!! Looking forward to the one about tox-rs!!
Roman
@kpp

Can I?

Yes!

Nom5.0 has a concept of unrecoverable error, it means that nom can’t continue parsing, so terminating process or thread is needed.

Why terminate process? We can clear our buffer and start parsing again when new data will come from the socket

inosms
@inosms

When I try to run the example I get this:

[2019-06-12T07:42:27Z ERROR tox::toxcore::dht::server_ext] Failed to handle packet: HandlePacketError { ctx: HandleDataResponseError { ctx: HandleDhtPkAnnounceError { ctx: stack backtrace:
...
toxcore/onion/client/mod.rs:515
...
Invalid no_reply }
Failed to handle DHT PublicKey announce }
Handling OnionClient packet failed }

Is this normal?

Roman
@kpp
yes
We should hide errors -> info, because they may make users nervous =)
inosms
@inosms
ok thank you!
inosms
@inosms

I am not sure why, but now I get

Processing ended with error: Custom { kind: Other, error: Compat { error: EncodeError { ctx: Os { code: 65, kind: Other, message: "No route to host" }

the only part in the stacktrace that hints to tox is:

  11: <tox::toxcore::dht::codec::EncodeError as core::convert::From<std::io::error::Error>>::from::h5f8353515d42ff73 (0x1053cdd2f)
             at /Users/inosms/Desktop/tox/src/toxcore/dht/codec.rs:104

any hints?

Evgeny Kurnevsky
@kurnevsky
It looks like it might happen because of network issues. Does it still happen?
inosms
@inosms
Yes, ok then it is a problem with my uni net... Will retry when at home!
Evgeny Kurnevsky
@kurnevsky
But you can write here so tox should be able to connect too :)
You can try to play with bootstrap nodes list.
Perhaps some of them are not available from your network...
inosms
@inosms
I guess it was a problem with the bootstrap nodes, thanks for the hint!
Roman
@kpp
good =)
inosms
@inosms
When trying to implement automatic accepting of friends where would I have to look? (which module? which package? Onion?)
Roman
@kpp
@kurnevsky will friend_connections.add_friend(friend_pk) be enough?
inosms
@inosms
ah yes this will probably work, but where can I listen for the friend request?
Evgeny Kurnevsky
@kurnevsky
We should add a setter method for it and like for other sinks.
But we can receive friend requests not only from onion client.
It can be received as lossless packet from net_crypto.
I'm not sure in which cases friend request can be sent via net crypto but c-toxcore has a handler for it.
Evgeny Kurnevsky
@kurnevsky
So probably we should merge friend requests streams inside friends module.
But that would mean we need to pass lossless packets via friends module as well (which we might need anyway) - right now we don't.
I think for a start it'll be enough to handle friend requests directly from onion client and later we can refactor it.
inosms
@inosms
ok thanks for the hints!!!
Cho
@NamsooCho
Create one unified DecodeError::Deserialize variant and place there nom::Err rather than placing Incomplete and Error separately.
#[derive(Debug, Clone, PartialEq)]
pub enum Err<E> {
  Incomplete(Needed),
  Error(E),
  Failure(E),
}
I worry that the Generic Err may increase code complexity.
Roman
@kpp
How many generic E in nom code?
Cho
@NamsooCho
I found solution. Use it by E as (&[u8], nom::error::ErrorKind)
Right?
Cho
@NamsooCho
#[derive(Clone, Debug, PartialEq, Fail)]
pub enum GetPayloadErrorKind {
    /// Error indicates that received payload of encrypted packet can't be decrypted
    #[fail(display = "Decrypt payload error")]
    Decrypt,
    /// Error indicates that decrypted payload of packet can't be parsed
    #[fail(display = "Deserialize payload error: {:?}, data: {:?}", error, payload)]
    Deserialize {
        /// Parsing error
        error: nom::Err<(&[u8], ErrorKind)>,
        /// Received payload of packet
        payload: Vec<u8>,
    }
}
error[E0106]: missing lifetime specifier
  --> src/toxcore/dht/packet/errors.rs:64:30
   |
64 |         error: Box<nom::Err<(&[u8], ErrorKind)>>,
   |                              ^ expected lifetime parameter
Fail requires static but can’t give static.
If i give it static then
error[E0597]: `decrypted` does not live long enough
   --> src/toxcore/dht/packet/ping_request.rs:93:46
    |
93  |         match PingRequestPayload::from_bytes(&decrypted) {
    |               -------------------------------^^^^^^^^^^-
    |               |                              |
    |               |                              borrowed value does not live long enough
    |               argument requires that `decrypted` is borrowed for `'static`
…
Roman
@kpp
That's right
You can store &str (or any reference) in a struct without a lifetime specifier
Cho
@NamsooCho
Ah
Thanks!
Roman
@kpp
So you have to either use String or another type
Cho
@NamsooCho
Ah I got it
inosms
@inosms
uh thanks for merging! :confetti_ball:
Cho
@NamsooCho
I will use &Vec<u8>, it also uses heap
Roman
@kpp
You can't store & in a struct