~statik/ubuntu/maverick/erlang/erlang-merge-testing

« back to all changes in this revision

Viewing changes to lib/megaco/src/tcp/megaco_tcp_connection.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-05-01 10:14:38 UTC
  • mfrom: (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090501101438-6qlr6rsdxgyzrg2z
Tags: 1:13.b-dfsg-2
* Cleaned up patches: removed unneeded patch which helped to support
  different SCTP library versions, made sure that changes for m68k
  architecture applied only when building on this architecture.
* Removed duplicated information from binary packages descriptions.
* Don't require libsctp-dev build-dependency on solaris-i386 architecture
  which allows to build Erlang on Nexenta (thanks to Tim Spriggs for
  the suggestion).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%%<copyright>
2
 
%% <year>1999-2007</year>
3
 
%% <holder>Ericsson AB, All Rights Reserved</holder>
4
 
%%</copyright>
5
 
%%<legalnotice>
 
1
%%
 
2
%% %CopyrightBegin%
 
3
%% 
 
4
%% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 
5
%% 
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
8
8
%% compliance with the License. You should have received a copy of the
9
9
%% Erlang Public License along with this software. If not, it can be
10
10
%% retrieved online at http://www.erlang.org/.
11
 
%%
 
11
%% 
12
12
%% Software distributed under the License is distributed on an "AS IS"
13
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
14
%% the License for the specific language governing rights and limitations
15
15
%% under the License.
 
16
%% 
 
17
%% %CopyrightEnd%
16
18
%%
17
 
%% The Initial Developer of the Original Code is Ericsson AB.
18
 
%%</legalnotice>
 
19
 
19
20
%%
20
21
%%-----------------------------------------------------------------
21
22
%%
98
99
init(Arg) ->
99
100
    %% process_flag(trap_exit, true),
100
101
    ?tcp_debug(Arg, "tcp connection handler starting", [self()]),
 
102
%%     info_msg("starting with"
 
103
%%           "~n   Arg: ~p", [Arg]),
101
104
    {ok, Arg}.
102
105
 
103
106
 
185
188
receive_message(Mod, RH, SendHandle, Length, Msg) ->
186
189
    Opts = [link , {min_heap_size, ?HEAP_SIZE(Length)}],
187
190
    spawn_opt(?MODULE, handle_received_message,
188
 
               [Mod, RH, self(), SendHandle, Msg], Opts),
 
191
              [Mod, RH, self(), SendHandle, Msg], Opts),
189
192
    ok.
190
193
 
191
194
 
199
202
%% Func: terminate/2
200
203
%% Description: Termination function for the generic server
201
204
%%-----------------------------------------------------------------
 
205
terminate(shutdown = _Reason, TcpRec) ->
 
206
    ?tcp_debug(TcpRec, "tcp connection handler terminating", [self(),_Reason]),
 
207
    ok;
 
208
 
202
209
terminate(Reason, TcpRec) ->
203
 
    ?tcp_debug(TcpRec, "tcp connection handler terminating", [self(),Reason]),
 
210
    ?tcp_debug(TcpRec, "tcp connection handler terminating", [self(), Reason]),
 
211
    SchedId      = erlang:system_info(scheduler_id),
 
212
    SchedNum     = erlang:system_info(schedulers),
 
213
    ProcCount    = erlang:system_info(process_count),
 
214
    ProcLimit    = erlang:system_info(process_limit),
 
215
    ProcMemUsed  = erlang:memory(processes_used),
 
216
    ProcMemAlloc = erlang:memory(processes),
 
217
    MemTot       = erlang:memory(total),
 
218
    error_msg("abormal termination: "
 
219
              "~n   Scheduler id:                         ~p"
 
220
              "~n   Num scheduler:                        ~p"
 
221
              "~n   Process count:                        ~p"
 
222
              "~n   Process limit:                        ~p"
 
223
              "~n   Memory used by erlang processes:      ~p"
 
224
              "~n   Memory allocated by erlang processes: ~p"
 
225
              "~n   The total amount of memory allocated: ~p"
 
226
              "~n~p", 
 
227
              [SchedId, SchedNum, ProcCount, ProcLimit, 
 
228
               ProcMemUsed, ProcMemAlloc, MemTot, Reason]),
204
229
    ok.
205
230
 
206
231
 
235
260
    ets:update_counter(megaco_tcp_stats, Key, Inc).
236
261
 
237
262
 
238
 
% info_msg(F, A) ->
239
 
%     ?megaco_info("TCP connection handler " ++ F", A)).
 
263
%% info_msg(F, A) ->
 
264
%%     ?megaco_info("TCP connection handler " ++ F, A).
240
265
  
241
266
warning_msg(F, A) ->
242
267
    ?megaco_warning("TCP connection handler: " ++ F, A).