Skip to content

Commit b372f7b

Browse files
authored
Compatibility with libevent 2.2 (transmission#7765)
* Compatibility with libevent 2.2 * Fix Android builds * Fix Win32 builds
1 parent a2d2097 commit b372f7b

5 files changed

Lines changed: 80 additions & 96 deletions

File tree

.gitmodules

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
branch = post-1.2.1-transmission
99
[submodule "third-party/libevent"]
1010
path = third-party/libevent
11-
url = https://github.com/transmission/libevent.git
12-
branch = post-2.1.12-transmission
11+
# Windows/Android build fixes (libevent/libevent#1813 and libevent/libevent#1817)
12+
url = https://github.com/coeur/libevent.git
13+
branch = master
1314
[submodule "third-party/libnatpmp"]
1415
path = third-party/libnatpmp
1516
url = https://github.com/transmission/libnatpmp.git

Transmission.xcodeproj/project.pbxproj

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,8 @@
433433
C8B27BA328153F6300A22B5D /* create.cc in Sources */ = {isa = PBXBuildFile; fileRef = C887BEC02807FCE900867D3C /* create.cc */; };
434434
C8B27BA428153F6600A22B5D /* edit.cc in Sources */ = {isa = PBXBuildFile; fileRef = C887BEC22807FCE900867D3C /* edit.cc */; };
435435
C8B27BA528153F6900A22B5D /* show.cc in Sources */ = {isa = PBXBuildFile; fileRef = C887BEC32807FCE900867D3C /* show.cc */; };
436+
C8C3508D2DEB812400E94512 /* ws.c in Sources */ = {isa = PBXBuildFile; fileRef = C8C3508C2DEB812400E94512 /* ws.c */; };
437+
C8C3508F2DEB817F00E94512 /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = C8C3508E2DEB817F00E94512 /* sha1.c */; };
436438
C8ED0FB1281C10F100B44472 /* addr_is_reserved.c in Sources */ = {isa = PBXBuildFile; fileRef = C8ED0FAF281C10F100B44472 /* addr_is_reserved.c */; };
437439
C8ED0FB2281C10F100B44472 /* addr_is_reserved.h in Headers */ = {isa = PBXBuildFile; fileRef = C8ED0FB0281C10F100B44472 /* addr_is_reserved.h */; };
438440
CAB35C64252F6F5E00552A55 /* mime-types.h in Headers */ = {isa = PBXBuildFile; fileRef = CAB35C62252F6F5E00552A55 /* mime-types.h */; };
@@ -1404,6 +1406,8 @@
14041406
C8B27B7F28153F2B00A22B5D /* transmission-create */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "transmission-create"; sourceTree = BUILT_PRODUCTS_DIR; };
14051407
C8B27B9028153F3100A22B5D /* transmission-edit */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "transmission-edit"; sourceTree = BUILT_PRODUCTS_DIR; };
14061408
C8B27BA128153F3400A22B5D /* transmission-show */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "transmission-show"; sourceTree = BUILT_PRODUCTS_DIR; };
1409+
C8C3508C2DEB812400E94512 /* ws.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ws.c; sourceTree = "<group>"; };
1410+
C8C3508E2DEB817F00E94512 /* sha1.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sha1.c; sourceTree = "<group>"; };
14071411
C8ED0FAF281C10F100B44472 /* addr_is_reserved.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = addr_is_reserved.c; sourceTree = "<group>"; };
14081412
C8ED0FB0281C10F100B44472 /* addr_is_reserved.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = addr_is_reserved.h; sourceTree = "<group>"; };
14091413
CAB35C62252F6F5E00552A55 /* mime-types.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = "mime-types.h"; sourceTree = "<group>"; };
@@ -2258,7 +2262,9 @@
22582262
A2074FC612BEABC800F70985 /* log.c */,
22592263
A207503612BEADA200F70985 /* poll.c */,
22602264
A207503412BEAD9C00F70985 /* select.c */,
2265+
C8C3508E2DEB817F00E94512 /* sha1.c */,
22612266
A2074FDD12BEAC5000F70985 /* signal.c */,
2267+
C8C3508C2DEB812400E94512 /* ws.c */,
22622268
);
22632269
name = libevent;
22642270
path = "third-party/libevent";
@@ -3679,6 +3685,8 @@
36793685
A2074F5B12BEA8E000F70985 /* bufferevent_pair.c in Sources */,
36803686
A2074F5D12BEA8E000F70985 /* bufferevent_sock.c in Sources */,
36813687
A2074F5E12BEA8E000F70985 /* bufferevent.c in Sources */,
3688+
C8C3508D2DEB812400E94512 /* ws.c in Sources */,
3689+
C8C3508F2DEB817F00E94512 /* sha1.c in Sources */,
36823690
A2074F7412BEAA3300F70985 /* event.c in Sources */,
36833691
A2074F8512BEAA6600F70985 /* evmap.c in Sources */,
36843692
A2074F9912BEAAAF00F70985 /* evthread.c in Sources */,
@@ -4309,8 +4317,14 @@
43094317
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
43104318
GCC_WARN_UNUSED_FUNCTION = NO;
43114319
GENERATE_MASTER_OBJECT_FILE = YES;
4312-
HEADER_SEARCH_PATHS = "third-party/libevent/include";
4313-
OTHER_CFLAGS = "-DHAVE_CONFIG_H";
4320+
HEADER_SEARCH_PATHS = (
4321+
"third-party/libevent/include",
4322+
"third-party/libevent/compat",
4323+
);
4324+
OTHER_CFLAGS = (
4325+
"-DHAVE_CONFIG_H",
4326+
"-DLITTLE_ENDIAN",
4327+
);
43144328
PRODUCT_NAME = event;
43154329
};
43164330
name = Debug;
@@ -4986,8 +5000,14 @@
49865000
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
49875001
GCC_WARN_UNUSED_FUNCTION = NO;
49885002
GENERATE_MASTER_OBJECT_FILE = YES;
4989-
HEADER_SEARCH_PATHS = "third-party/libevent/include";
4990-
OTHER_CFLAGS = "-DHAVE_CONFIG_H";
5003+
HEADER_SEARCH_PATHS = (
5004+
"third-party/libevent/include",
5005+
"third-party/libevent/compat",
5006+
);
5007+
OTHER_CFLAGS = (
5008+
"-DHAVE_CONFIG_H",
5009+
"-DLITTLE_ENDIAN",
5010+
);
49915011
PRODUCT_NAME = event;
49925012
};
49935013
name = "Release - Debug";
@@ -5140,8 +5160,14 @@
51405160
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
51415161
GCC_WARN_UNUSED_FUNCTION = NO;
51425162
GENERATE_MASTER_OBJECT_FILE = YES;
5143-
HEADER_SEARCH_PATHS = "third-party/libevent/include";
5144-
OTHER_CFLAGS = "-DHAVE_CONFIG_H";
5163+
HEADER_SEARCH_PATHS = (
5164+
"third-party/libevent/include",
5165+
"third-party/libevent/compat",
5166+
);
5167+
OTHER_CFLAGS = (
5168+
"-DHAVE_CONFIG_H",
5169+
"-DLITTLE_ENDIAN",
5170+
);
51455171
PRODUCT_NAME = event;
51465172
};
51475173
name = Release;

libtransmission/rpc-server.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,11 @@ void handle_web_client(struct evhttp_request* req, tr_rpc_server const* server)
335335
{
336336
if (auto* const con = evhttp_request_get_connection(req); con != nullptr)
337337
{
338+
#if LIBEVENT_VERSION_NUMBER >= 0x02020001
339+
char const* remote_host = nullptr;
340+
#else
338341
char* remote_host = nullptr;
342+
#endif
339343
auto remote_port = ev_uint16_t{};
340344
evhttp_connection_get_peer(con, &remote_host, &remote_port);
341345
tr_logAddWarn(fmt::format(
@@ -509,7 +513,11 @@ void handle_request(struct evhttp_request* req, void* arg)
509513

510514
auto* server = static_cast<tr_rpc_server*>(arg);
511515

516+
#if LIBEVENT_VERSION_NUMBER >= 0x02020001
517+
char const* remote_host = nullptr;
518+
#else
512519
char* remote_host = nullptr;
520+
#endif
513521
auto remote_port = ev_uint16_t{};
514522
evhttp_connection_get_peer(con, &remote_host, &remote_port);
515523

third-party/libevent

Submodule libevent updated 202 files

0 commit comments

Comments
 (0)