Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apns:get_feedback error #199

Open
NoobsEnslaver opened this issue Aug 20, 2017 · 0 comments
Open

apns:get_feedback error #199

NoobsEnslaver opened this issue Aug 20, 2017 · 0 comments

Comments

@NoobsEnslaver
Copy link

when i try to get feedback like this:

VoipFeedbackConf = #{certfile => VoipCertFilePath
                        ,keyfile => VoipKeyFilePath
                        ,host => FeedbackServer
                        ,port => 2196
                        ,timeout => FeedbackTimeout},
Self = self(),
Fun = fun()-> Self ! {'feedback', apns:get_feedback(VoipFeedbackConf)} end,
{_Pid, Ref} = erlang:spawn_monitor(Fun),
{noreply, State#state{voip_ref = Ref}};

handle_info({'DOWN', Ref, _Type, _Pid, _Info}, #state{voip_ref = Ref, get_feedback_interval = GetFeedbackInterval} = State) ->
    lager:debug("apns feedback process down: ~p", [_Info]),
    erlang:send_after(GetFeedbackInterval, self(), 'get_voip_feedback'),
    {noreply, State#state{voip_ref = 'undefined'}};

i get error

2017-08-20 10:14:10.410 [debug][system]<0.922.0>|?|push_apple_server:201| apns feedback process down: {badarg,[{erlang,bit_size,[[89,153,152,246,0,32,136,131,4,42,216,135,56,173,209,154,75,225,106,81,28,141,237,232,56,0,92,94,210,193,61,210,77,198,18,4,76,251]],[]},{apns_feedback,build_feedback,5,[{file,"/home/ne/Projects/egg/_build/default/lib/apns/src/apns_feedback.erl"},{line,87}]},{apns_feedback,get_feedback,1,[{file,"/home/ne/Projects/egg/_build/default/lib/apns/src/apns_feedback.erl"},{line,47}]},{push_apple_server,'-handle_info/2-fun-1-',2,[{file,"/home/ne/Projects/egg/_build/prod/lib/push/src/push_apple_server.erl"},{line,193}]}]}
{badarg,[{erlang,bit_size,[[89,153,152,246,0,32,136,131,4,42,216,135,56,173,209,154,75,225,106,81,28,141,237,232,56,0,92,94,210,193,61,210,77,198,18,4,76,251]],[]},{apns_feedback,build_feedback,5,[{file,"/home/ne/Projects/egg/_build/default/lib/apns/src/apns_feedback.erl"},{line,87}]},{apns_feedback,get_feedback,1,[{file,"/home/ne/Projects/egg/_build/default/lib/apns/src/apns_feedback.erl"},{line,47}]},{push_apple_server,'-handle_info/2-fun-1-',2,[{file,"/home/ne/Projects/egg/_build/prod/lib/push/src/push_apple_server.erl"},{line,193}]}]}

i think, that because in apns_feedback we expect binary data from ssl in active mode, but by default ssl send data as list (see http://erlang.org/doc/man/ssl.html : The default socket options are [{mode,list},{packet, 0},{header, 0},{active, true}]., but i was try to fix it - fork it and add to apns_feedback:46 line ssl:setopts(Socket, [{mode, raw}]), - it doesn't help

i use tag 2.2.0 version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant