equal
deleted
inserted
replaced
36 |
36 |
37 #include "lm-blocking-resolver.h" |
37 #include "lm-blocking-resolver.h" |
38 |
38 |
39 #define SRV_LEN 8192 |
39 #define SRV_LEN 8192 |
40 |
40 |
41 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), LM_TYPE_BLOCKING_RESOLVER, LmBlockingResolverPriv)) |
41 #define GET_PRIV(obj) (lm_blocking_resolver_get_instance_private (LM_BLOCKING_RESOLVER(obj))) |
42 |
42 |
43 typedef struct LmBlockingResolverPriv LmBlockingResolverPriv; |
43 typedef struct LmBlockingResolverPrivate LmBlockingResolverPrivate; |
44 struct LmBlockingResolverPriv { |
44 struct LmBlockingResolverPrivate { |
45 GSource *idle_source; |
45 GSource *idle_source; |
46 }; |
46 }; |
47 |
47 |
48 static void blocking_resolver_dispose (GObject *object); |
48 static void blocking_resolver_dispose (GObject *object); |
49 static void blocking_resolver_lookup (LmResolver *resolver); |
49 static void blocking_resolver_lookup (LmResolver *resolver); |
50 static void blocking_resolver_cancel (LmResolver *resolver); |
50 static void blocking_resolver_cancel (LmResolver *resolver); |
51 |
51 |
52 G_DEFINE_TYPE (LmBlockingResolver, lm_blocking_resolver, LM_TYPE_RESOLVER) |
52 G_DEFINE_TYPE_WITH_PRIVATE (LmBlockingResolver, lm_blocking_resolver, LM_TYPE_RESOLVER) |
53 |
53 |
54 static void |
54 static void |
55 lm_blocking_resolver_class_init (LmBlockingResolverClass *class) |
55 lm_blocking_resolver_class_init (LmBlockingResolverClass *class) |
56 { |
56 { |
57 GObjectClass *object_class = G_OBJECT_CLASS (class); |
57 GObjectClass *object_class = G_OBJECT_CLASS (class); |
59 |
59 |
60 object_class->dispose = blocking_resolver_dispose; |
60 object_class->dispose = blocking_resolver_dispose; |
61 |
61 |
62 resolver_class->lookup = blocking_resolver_lookup; |
62 resolver_class->lookup = blocking_resolver_lookup; |
63 resolver_class->cancel = blocking_resolver_cancel; |
63 resolver_class->cancel = blocking_resolver_cancel; |
64 |
|
65 g_type_class_add_private (object_class, |
|
66 sizeof (LmBlockingResolverPriv)); |
|
67 } |
64 } |
68 |
65 |
69 static void |
66 static void |
70 lm_blocking_resolver_init (LmBlockingResolver *blocking_resolver) |
67 lm_blocking_resolver_init (LmBlockingResolver *blocking_resolver) |
71 { |
68 { |
189 } |
186 } |
190 |
187 |
191 static gboolean |
188 static gboolean |
192 blocking_resolver_idle_lookup (LmBlockingResolver *resolver) |
189 blocking_resolver_idle_lookup (LmBlockingResolver *resolver) |
193 { |
190 { |
194 LmBlockingResolverPriv *priv = GET_PRIV (resolver); |
191 LmBlockingResolverPrivate *priv = GET_PRIV (resolver); |
195 gint type; |
192 gint type; |
196 |
193 |
197 /* Start the DNS querying */ |
194 /* Start the DNS querying */ |
198 |
195 |
199 /* Decide if we are going to lookup a srv or host */ |
196 /* Decide if we are going to lookup a srv or host */ |
214 } |
211 } |
215 |
212 |
216 static void |
213 static void |
217 blocking_resolver_lookup (LmResolver *resolver) |
214 blocking_resolver_lookup (LmResolver *resolver) |
218 { |
215 { |
219 LmBlockingResolverPriv *priv; |
216 LmBlockingResolverPrivate *priv; |
220 GMainContext *context; |
217 GMainContext *context; |
221 |
218 |
222 g_return_if_fail (LM_IS_BLOCKING_RESOLVER (resolver)); |
219 g_return_if_fail (LM_IS_BLOCKING_RESOLVER (resolver)); |
223 |
220 |
224 priv = GET_PRIV (resolver); |
221 priv = GET_PRIV (resolver); |
231 } |
228 } |
232 |
229 |
233 static void |
230 static void |
234 blocking_resolver_cancel (LmResolver *resolver) |
231 blocking_resolver_cancel (LmResolver *resolver) |
235 { |
232 { |
236 LmBlockingResolverPriv *priv; |
233 LmBlockingResolverPrivate *priv; |
237 |
234 |
238 g_return_if_fail (LM_IS_BLOCKING_RESOLVER (resolver)); |
235 g_return_if_fail (LM_IS_BLOCKING_RESOLVER (resolver)); |
239 |
236 |
240 priv = GET_PRIV (resolver); |
237 priv = GET_PRIV (resolver); |
241 |
238 |