Opened 6 years ago
Last modified 5 years ago
#5888 new Enhancement
Upgrade to new libutp API from uTorrent 3.4
Reported by: | jbeich | Owned by: | jordan |
---|---|---|---|
Priority: | Normal | Milestone: | None Set |
Component: | libtransmission | Version: | 2.84 |
Severity: | Normal | Keywords: | |
Cc: |
Description
libutp API changed in 3652544 [1] and Transmission fails to build if system libutp isn't before the change. Main benefit of the upgrade would be easier communication with upstream (pulling/pushing fixes).
[1] https://github.com/bittorrent/libutp/commit/3652544
peer-io.c:520:32: error: variable has incomplete type 'struct UTPFunctionTable' static struct UTPFunctionTable utp_function_table = { ^ peer-io.c:520:15: note: forward declaration of 'struct UTPFunctionTable' static struct UTPFunctionTable utp_function_table = { ^ peer-io.c:575:32: error: variable has incomplete type 'struct UTPFunctionTable' static struct UTPFunctionTable dummy_utp_function_table = { ^ peer-io.c:520:15: note: forward declaration of 'struct UTPFunctionTable' static struct UTPFunctionTable utp_function_table = { ^ peer-io.c:641:9: warning: implicit declaration of function 'UTP_SetSockopt' is invalid in C99 [-Wimplicit-function-declaration] UTP_SetSockopt (utp_socket, SO_RCVBUF, UTP_READ_BUFFER_SIZE); ^ peer-io.c:643:9: warning: implicit declaration of function 'UTP_SetCallbacks' is invalid in C99 [-Wimplicit-function-declaration] UTP_SetCallbacks (utp_socket, ^ peer-io.c:648:13: warning: implicit declaration of function 'UTP_Connect' is invalid in C99 [-Wimplicit-function-declaration] UTP_Connect (utp_socket); ^ peer-io.c:810:9: warning: implicit declaration of function 'UTP_Close' is invalid in C99 [-Wimplicit-function-declaration] UTP_Close (io->utp_socket); ^ peer-io.c:1233:17: warning: implicit declaration of function 'UTP_RBDrained' is invalid in C99 [-Wimplicit-function-declaration] UTP_RBDrained (io->utp_socket); ^ peer-io.c:1278:13: warning: implicit declaration of function 'UTP_Write' is invalid in C99 [-Wimplicit-function-declaration] UTP_Write (io->utp_socket, howmuch); ^ 6 warnings and 2 errors generated.
Attachments (1)
Change History (6)
comment:1 Changed 6 years ago by mike.dld
Changed 6 years ago by mike.dld
comment:2 Changed 6 years ago by mike.dld
- Component changed from Transmission to libtransmission
- Owner set to jordan
comment:3 Changed 6 years ago by mike.dld
Closed #5984 as duplicate of this ticket.
comment:4 follow-up: ↓ 5 Changed 6 years ago by funkstar
With closing my ticket do you plan on taking the process of updating libutp as a serious priority?
comment:5 in reply to: ↑ 4 Changed 6 years ago by cfpp2p
Replying to funkstar:
With closing my ticket do you plan on taking the process of updating libutp as a serious priority?
Please see my post ticket:5984#comment:2 It doesn't appear to be of immediate elevated seriousness for transmission.
Here is my attempt to adjust libT code to this new API. It kind of works, but for some reason the speed is never good. While old code is giving me up to 1+ MB/s, patched one is around 10 KB/s on average. Maybe someone else could take a look as well.
Forgive me the coding style, I was trying to reduce the patch size. For the same reason I didn't remove some now-unused code and didn't make it compile with uTP disabled. As you can see, the changes are not huge at all. Main difference is in the way writing to the socket is being made, everything else is mostly the same.
Single known issue (apart from those mentioned before) is that when socket is being created in tr_peerIoNewOutgoing (tr_netOpenPeerSocket), utp_connect is called before userdata (io) is set on the socket (which is done inside tr_peerIoNew after peer io object is allocated) which leads to a couple of callbacks being discarded. I tried calling utp_connect when userdata is already set, makes no difference.
Patch only includes libT changes. Those interested should be able to make additional changes in corresponding CMakeLists.txt or Makefile.am files themselves.