Opened 11 years ago

Last modified 9 years ago

#4146 new Enhancement

Make announcer / web code more modular

Reported by: jordan Owned by: jordan
Priority: Low Milestone: Sometime
Component: libtransmission Version: 2.22
Severity: Normal Keywords:
Cc: nikoli@…


It's impossible to scrape UDP trackers from transmission-show because the mechanisms for it are buried deep inside libtransmission. This is a symptom of a wider problem, that much of libtransmission is too tightly coupled.

It would be nice if we could have an announcer context mechanism that wasn't dependent on tr_session.

By necessity this would require web.c to have a context separate from tr_session too.

tr_web_context would need:

  • Some flag or mechanism to know when to shutdown, currently handled by testing tr_session.isClosed
  • The public IPv4 and IPv6 interfaces for CURLOPT_INTERFACE, currently handled by tr_sessionGetPublicAddress() and tr_sessionGetPublicAddress()
  • A curl_easy_config_func, currently handled by tr_session.curl_easy_config_func

tr_announcer_context would need:

  • The IPv4 and IPv6 ports for sending UDP tracker requests
  • A pointer to an externally-owned event base s.t. it can create and manage the evdns currently handled by tr_session
  • The delegation mechanism in announcer.c which decides whether to use tr_tracker_http_announce() or tr_tracker_udp_announce() could be moved into a helper function, tr_announcer_context_announce(), and the other two functions could be made private.
  • The same could be done for scrapes

Public API s.t. tr_session and transmission-show could both use this code

  • announcer_context_new()
  • announcer_context_begin_shutdown()
  • announcer_context_destroy()
  • announcer_context_send_scrape()
  • announcer_context_send_announce()
  • void announcer_context_upkeep()
  • bool announcer_context_process_udp_packet()

Other structural changes:

  • announcer.c would own & manage the tr_session's announcer context
  • tr_session would need to be removed from libtransmission's announcer-udp.c, announcer-http.c, and web.c
  • after these changes, "tr_announcer" and "tr_announcer_context" would be confusingly named wrt each other, and tr_announcer_context is pretty verbose. Better names would be a plus.

Change History (2)

comment:1 Changed 11 years ago by jordan

  • Version changed from 2.22+ to 2.22

comment:2 Changed 9 years ago by Nikoli

  • Cc nikoli@… added
Note: See TracTickets for help on using tickets.