aboutsummaryrefslogtreecommitdiffstats
path: root/net-im/ejabberd/files/patch-erlang-17-dict-queue
blob: ace41dd408e2fb9fc64f721efa67c871c2cbdf67 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
Fixes to make it work with Erlang R17

--- ../deps/riak_pb/src/riak_pb_kv_codec.erl.orig
+++ ../deps/riak_pb/src/riak_pb_kv_codec.erl
@@ -49,7 +49,11 @@
 
 -type symbolic_quorum() :: one | quorum | all | default.
 -type value() :: binary().
+-ifdef(ERLANG_17).
+-type metadata() :: dict:dict().
+-else.
 -type metadata() :: dict().
+-endif.
 -type contents() :: [{metadata(), value()}].
 
 %% @doc Convert a list of object {MetaData,Value} pairs to protocol

--- ../deps/riak_pb/rebar.config.orig
+++ ../deps/riak_pb/rebar.config
@@ -1,5 +1,5 @@
 %% -*- mode: erlang -*-
-{erl_opts, [debug_info]}.
+{erl_opts, [{platform_define, "^1[78]-", 'ERLANG_17'},debug_info]}.
 {deps, [
         {protobuffs, "0.8.1", {git, "git://github.com/basho/erlang_protobuffs.git", {tag, "0.8.1p1"}}}
        ]}.

--- ../deps/esip/src/esip_listener.erl.orig
+++ ../deps/esip/src/esip_listener.erl
@@ -37,7 +37,11 @@
 
 -include("esip_lib.hrl").
 -define(TCP_SEND_TIMEOUT, 10000).
+-ifdef(ERLANG_17).
+-record(state, {listeners = dict:new() :: dict:dict()}).
+-else.
 -record(state, {listeners = dict:new() :: dict()}).
+-endif.
 
 %%%===================================================================
 %%% API

--- ../deps/esip/rebar.config.orig
+++ ../deps/esip/rebar.config
@@ -1,4 +1,5 @@
-{erl_opts, [{i, "include"},
+{erl_opts, [{platform_define, "^1[78]-", 'ERLANG_17'},
+       {i, "include"},
        {i, "deps/p1_stun/include"},
        {i, "../p1_stun/include"}]}.
 

--- ../deps/p1_stun/src/turn.erl.orig
+++ ../deps/p1_stun/src/turn.erl
@@ -56,6 +56,29 @@
 
 -type addr() :: {inet:ip_address(), inet:port_number()}.
 
+-ifdef(ERLANG_17).
+-record(state,
+   {sock_mod = gen_udp             :: gen_udp | gen_tcp | p1_tls,
+    sock                           :: inet:socket() | p1_tls:tls_socket(),
+    addr = {{0,0,0,0}, 0}          :: addr(),
+    owner = self()                 :: pid(),
+    username = <<"">>              :: binary(),
+    realm = <<"">>                 :: binary(),
+    key = {<<"">>, <<"">>, <<"">>} :: {binary(), binary(), binary()},
+    server_name = <<"">>           :: binary(),
+    permissions = ?DICT:new()      :: dict:dict(),
+    channels = ?DICT:new()         :: dict:dict(),
+    max_permissions                :: non_neg_integer() | atom(),
+    relay_ip = {127,0,0,1}         :: inet:ip_address(),
+    min_port = 49152               :: non_neg_integer(),
+    max_port = 65535               :: non_neg_integer(),
+    relay_addr                     :: addr(),
+    relay_sock                     :: inet:socket(),
+    last_trid                      :: non_neg_integer(),
+    last_pkt = <<>>                :: binary(),
+    seq = 1                        :: non_neg_integer(),
+    life_timer                     :: reference()}).
+-else.
 -record(state,
    {sock_mod = gen_udp             :: gen_udp | gen_tcp | p1_tls,
     sock                           :: inet:socket() | p1_tls:tls_socket(),
@@ -77,6 +100,7 @@
     last_pkt = <<>>                :: binary(),
     seq = 1                        :: non_neg_integer(),
     life_timer                     :: reference()}).
+-endif.
 
 %%====================================================================
 %% API

--- ../deps/p1_stun/rebar.config.orig
+++ ../deps/p1_stun/rebar.config
@@ -1,4 +1,5 @@
-{erl_opts, [debug_info, {i, "include"}]}.
+{erl_opts, [{platform_define, "^1[78]-", 'ERLANG_17'},
+       debug_info, {i, "include"}]}.
 
 {deps, [{p1_tls, ".*", {git, "git://github.com/processone/tls.git"}},
    {p1_utils, ".*", {git, "git://github.com/processone/p1_utils.git"}}]}.

--- ../deps/p1_stun/src/stun_listener.erl.orig
+++ ../deps/p1_stun/src/stun_listener.erl
@@ -36,7 +36,11 @@
          terminate/2, code_change/3]).
 
 -define(TCP_SEND_TIMEOUT, 10000).
+-ifdef(ERLANG_17).
+-record(state, {listeners = dict:new() :: dict:dict()}).
+-else.
 -record(state, {listeners = dict:new() :: dict()}).
+-endif.
 
 %%%===================================================================
 %%% API
--- ../deps/riakc/rebar.config.orig
+++ ../deps/riakc/rebar.config
@@ -1,6 +1,8 @@
 {cover_enabled, true}.
 {eunit_opts, [verbose]}.
-{erl_opts, [warnings_as_errors, debug_info]}.
+{erl_opts, [
+   {platform_define, "^1[78]-", 'ERLANG_17'},
+        warnings_as_errors, debug_info]}.
 {deps, [
         {riak_pb, ".*", {git, "git://github.com/basho/riak_pb", {tag, "1.4.4.0"}}}
        ]}.
--- ../deps/riakc/src/riakc_obj.erl.orig
+++ ../deps/riakc/src/riakc_obj.erl
@@ -79,7 +79,11 @@
 -type key() :: binary() | 'undefined'. %% A key name
 -type id() :: {bucket(), key()}.
 -type vclock() :: binary(). %% An opaque vector clock
+-ifdef(ERLANG_17).
+-type metadata() :: dict:dict(). %% Value metadata
+-else.
 -type metadata() :: dict(). %% Value metadata
+-endif.
 -type content_type() :: string(). %% The media type of a value
 -type value() :: binary(). %% An opaque value
 -type contents() :: [{metadata(), value()}]. %% All metadata/value pairs in a `riakc_obj'.
@@ -98,6 +102,16 @@
 -type tag() :: binary().
 -type link() :: {tag(), [id()]}.
 
+-ifdef(ERLANG_17).
+-record(riakc_obj, {
+          bucket :: bucket(),
+          key :: key(),
+          vclock :: vclock(),
+          contents :: contents(),
+          updatemetadata :: dict:dict(),
+          updatevalue :: value()
+         }).
+-else.
 -record(riakc_obj, {
           bucket :: bucket(),
           key :: key(),
@@ -106,6 +120,7 @@
           updatemetadata :: dict(),
           updatevalue :: value()
          }).
+-endif.
 
 -type riakc_obj() :: #riakc_obj{}. %% The record/type containing the entire Riak object.
 -export_type([riakc_obj/0, bucket/0, key/0, vclock/0, contents/0, metadata/0, value/0,
@@ -284,7 +299,11 @@
     end.
 
 %% @doc  Return the content type from metadata
+-ifdef(ERLANG_17).
+-spec md_ctype(dict:dict()) -> undefined | content_type().
+-else.
 -spec md_ctype(dict()) -> undefined | content_type().
+-endif.
 md_ctype(MetaData) ->
     case dict:find(?MD_CTYPE, MetaData) of
         error ->
--- ../deps/riakc/src/riakc_pb_socket.erl.orig
+++ ../deps/riakc/src/riakc_pb_socket.erl
@@ -110,6 +110,20 @@
 
 -type portnum() :: non_neg_integer(). %% The TCP port number of the Riak node's Protocol Buffers interface
 -type address() :: string() | atom() | inet:ip_address(). %% The TCP/IP host name or address of the Riak node
+-ifdef(ERLANG_17).
+-record(state, {address :: address(),    % address to connect to
+                port :: portnum(),       % port to connect to
+                auto_reconnect = false :: boolean(), % if true, automatically reconnects to server
+                                        % if false, exits on connection failure/request timeout
+                queue_if_disconnected = false :: boolean(), % if true, add requests to queue if disconnected
+                sock :: port(),       % gen_tcp socket
+                active :: #request{} | undefined,     % active request
+                queue :: queue:queue() | undefined,      % queue of pending requests
+                connects=0 :: non_neg_integer(), % number of successful connects
+                failed=[] :: [connection_failure()],  % breakdown of failed connects
+                connect_timeout=infinity :: timeout(), % timeout of TCP connection
+                reconnect_interval=?FIRST_RECONNECT_INTERVAL :: non_neg_integer()}).
+-else.
 -record(state, {address :: address(),    % address to connect to
                 port :: portnum(),       % port to connect to
                 auto_reconnect = false :: boolean(), % if true, automatically reconnects to server
@@ -122,6 +136,7 @@
                 failed=[] :: [connection_failure()],  % breakdown of failed connects
                 connect_timeout=infinity :: timeout(), % timeout of TCP connection
                 reconnect_interval=?FIRST_RECONNECT_INTERVAL :: non_neg_integer()}).
+-endif.
 
 %% @doc Create a linked process to talk with the riak server on Address:Port
 %%      Client id will be assigned by the server.