diff options
Diffstat (limited to 'src/core/core_api_monitor_peers.c')
-rw-r--r-- | src/core/core_api_monitor_peers.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/src/core/core_api_monitor_peers.c b/src/core/core_api_monitor_peers.c index 0ebb94d7b..165f741d2 100644 --- a/src/core/core_api_monitor_peers.c +++ b/src/core/core_api_monitor_peers.c | |||
@@ -54,7 +54,6 @@ struct GNUNET_CORE_MonitorHandle | |||
54 | * Closure for @e peer_cb. | 54 | * Closure for @e peer_cb. |
55 | */ | 55 | */ |
56 | void *peer_cb_cls; | 56 | void *peer_cb_cls; |
57 | |||
58 | }; | 57 | }; |
59 | 58 | ||
60 | 59 | ||
@@ -77,11 +76,11 @@ reconnect (struct GNUNET_CORE_MonitorHandle *mh); | |||
77 | * @param error error code | 76 | * @param error error code |
78 | */ | 77 | */ |
79 | static void | 78 | static void |
80 | handle_mq_error (void *cls, | 79 | handle_mq_error (void *cls, enum GNUNET_MQ_Error error) |
81 | enum GNUNET_MQ_Error error) | ||
82 | { | 80 | { |
83 | struct GNUNET_CORE_MonitorHandle *mh = cls; | 81 | struct GNUNET_CORE_MonitorHandle *mh = cls; |
84 | 82 | ||
83 | (void) error; | ||
85 | reconnect (mh); | 84 | reconnect (mh); |
86 | } | 85 | } |
87 | 86 | ||
@@ -93,8 +92,7 @@ handle_mq_error (void *cls, | |||
93 | * @param mon_message monitor message | 92 | * @param mon_message monitor message |
94 | */ | 93 | */ |
95 | static void | 94 | static void |
96 | handle_receive_info (void *cls, | 95 | handle_receive_info (void *cls, const struct MonitorNotifyMessage *mon_message) |
97 | const struct MonitorNotifyMessage *mon_message) | ||
98 | { | 96 | { |
99 | struct GNUNET_CORE_MonitorHandle *mh = cls; | 97 | struct GNUNET_CORE_MonitorHandle *mh = cls; |
100 | 98 | ||
@@ -114,24 +112,20 @@ handle_receive_info (void *cls, | |||
114 | static void | 112 | static void |
115 | reconnect (struct GNUNET_CORE_MonitorHandle *mh) | 113 | reconnect (struct GNUNET_CORE_MonitorHandle *mh) |
116 | { | 114 | { |
117 | struct GNUNET_MQ_MessageHandler handlers[] = { | 115 | struct GNUNET_MQ_MessageHandler handlers[] = |
118 | GNUNET_MQ_hd_fixed_size (receive_info, | 116 | {GNUNET_MQ_hd_fixed_size (receive_info, |
119 | GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY, | 117 | GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY, |
120 | struct MonitorNotifyMessage, | 118 | struct MonitorNotifyMessage, |
121 | mh), | 119 | mh), |
122 | GNUNET_MQ_handler_end () | 120 | GNUNET_MQ_handler_end ()}; |
123 | }; | ||
124 | struct GNUNET_MQ_Envelope *env; | 121 | struct GNUNET_MQ_Envelope *env; |
125 | struct GNUNET_MessageHeader *msg; | 122 | struct GNUNET_MessageHeader *msg; |
126 | 123 | ||
127 | if (NULL != mh->mq) | 124 | if (NULL != mh->mq) |
128 | GNUNET_MQ_destroy (mh->mq); | 125 | GNUNET_MQ_destroy (mh->mq); |
129 | /* FIXME: use backoff? */ | 126 | /* FIXME: use backoff? */ |
130 | mh->mq = GNUNET_CLIENT_connect (mh->cfg, | 127 | mh->mq = |
131 | "core", | 128 | GNUNET_CLIENT_connect (mh->cfg, "core", handlers, &handle_mq_error, mh); |
132 | handlers, | ||
133 | &handle_mq_error, | ||
134 | mh); | ||
135 | if (NULL == mh->mq) | 129 | if (NULL == mh->mq) |
136 | return; | 130 | return; |
137 | /* notify callback about reconnect */ | 131 | /* notify callback about reconnect */ |
@@ -140,10 +134,8 @@ reconnect (struct GNUNET_CORE_MonitorHandle *mh) | |||
140 | NULL, | 134 | NULL, |
141 | GNUNET_CORE_KX_CORE_DISCONNECT, | 135 | GNUNET_CORE_KX_CORE_DISCONNECT, |
142 | GNUNET_TIME_UNIT_FOREVER_ABS); | 136 | GNUNET_TIME_UNIT_FOREVER_ABS); |
143 | env = GNUNET_MQ_msg (msg, | 137 | env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS); |
144 | GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS); | 138 | GNUNET_MQ_send (mh->mq, env); |
145 | GNUNET_MQ_send (mh->mq, | ||
146 | env); | ||
147 | } | 139 | } |
148 | 140 | ||
149 | 141 | ||