~phablet-team/ofono/midori-support

« back to all changes in this revision

Viewing changes to plugins/push-notification.c

  • Committer: Alfonso Sanchez-Beato
  • Date: 2015-09-28 08:10:59 UTC
  • mfrom: (6830.1.168)
  • mto: This revision was merged to the branch mainline in revision 6904.
  • Revision ID: alfonso.sanchez-beato@canonical.com-20150928081059-1o08e2a9pkit6ar6
* Update to upstream release 1.17
* Do not assert when the radio is unavailable (LP: #1490991)
* Fix crash when importing phonebook (LP: #1486004)
* Check only destination port when receiving push (LP: #1490673)
* Fix crash when retrying to close context (LP: #1492483)

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#define PUSH_NOTIFICATION_INTERFACE "org.ofono.PushNotification"
42
42
#define AGENT_INTERFACE "org.ofono.PushNotificationAgent"
43
43
 
44
 
#define WAP_PUSH_SRC_PORT 9200
 
44
#define WAP_PUSH_SRC_PORT -1
45
45
#define WAP_PUSH_DST_PORT 2948
46
46
 
47
47
static unsigned int modemwatch_id;
50
50
        struct ofono_modem *modem;
51
51
        struct ofono_sms *sms;
52
52
        struct sms_agent *agent;
53
 
        unsigned int push_watch[2];
 
53
        unsigned int push_watch;
54
54
};
55
55
 
56
56
static void agent_exited(void *userdata)
57
57
{
58
58
        struct push_notification *pn = userdata;
59
59
 
60
 
        if (pn->push_watch[0] > 0) {
61
 
                __ofono_sms_datagram_watch_remove(pn->sms, pn->push_watch[0]);
62
 
                pn->push_watch[0] = 0;
63
 
        }
64
 
 
65
 
        if (pn->push_watch[1] > 0) {
66
 
                __ofono_sms_datagram_watch_remove(pn->sms, pn->push_watch[1]);
67
 
                pn->push_watch[1] = 0;
 
60
        if (pn->push_watch > 0) {
 
61
                __ofono_sms_datagram_watch_remove(pn->sms, pn->push_watch);
 
62
                pn->push_watch = 0;
68
63
        }
69
64
 
70
65
        pn->agent = NULL;
113
108
 
114
109
        sms_agent_set_removed_notify(pn->agent, agent_exited, pn);
115
110
 
116
 
        pn->push_watch[0] = __ofono_sms_datagram_watch_add(pn->sms,
 
111
        pn->push_watch = __ofono_sms_datagram_watch_add(pn->sms,
117
112
                                                        push_received,
118
113
                                                        WAP_PUSH_DST_PORT,
119
114
                                                        WAP_PUSH_SRC_PORT,
120
115
                                                        pn, NULL);
121
116
 
122
 
        pn->push_watch[1] = __ofono_sms_datagram_watch_add(pn->sms,
123
 
                                                        push_received,
124
 
                                                        WAP_PUSH_DST_PORT,
125
 
                                                        0, pn, NULL);
126
 
 
127
117
        return dbus_message_new_method_return(msg);
128
118
}
129
119
 
166
156
        DBG("%p", pn);
167
157
 
168
158
        /* The push watch was already cleaned up */
169
 
        pn->push_watch[0] = 0;
170
 
        pn->push_watch[1] = 0;
 
159
        pn->push_watch = 0;
171
160
        pn->sms = NULL;
172
161
 
173
162
        sms_agent_free(pn->agent);