Skip to content

Commit

Permalink
nl: Connect the socket ourselves when we create it
Browse files Browse the repository at this point in the history
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
  • Loading branch information
sardemff7 committed May 26, 2016
1 parent 67cb7b3 commit 173f2f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion nl/libgwater-nl.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ g_water_nl_source_new_cache_mngr(GMainContext *context, gint protocol, gint flag
}

GWaterNlSource *
g_water_nl_source_new_sock(GMainContext *context)
g_water_nl_source_new_sock(GMainContext *context, gint protocol)
{
struct nl_sock *sock;
GWaterNlSource *self;
Expand All @@ -139,6 +139,12 @@ g_water_nl_source_new_sock(GMainContext *context)
if ( sock == NULL )
return NULL;

if ( nl_connect(sock, protocol) < 0 )
{
nl_socket_free(sock);
return NULL;
}

self = g_water_nl_source_new_for_sock(context, sock);
self->owned = TRUE;

Expand Down
2 changes: 1 addition & 1 deletion nl/libgwater-nl.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ G_BEGIN_DECLS
typedef struct _GWaterNlSource GWaterNlSource;

GWaterNlSource *g_water_nl_source_new_cache_mngr(GMainContext *context, gint protocol, gint flags, gint *error);
GWaterNlSource *g_water_nl_source_new_sock(GMainContext *context);
GWaterNlSource *g_water_nl_source_new_sock(GMainContext *context, gint protocol);
GWaterNlSource *g_water_nl_source_new_for_cache_mngr(GMainContext *context, struct nl_cache_mngr *cache_mngr);
GWaterNlSource *g_water_nl_source_new_for_sock(GMainContext *context, struct nl_sock *sock);
void g_water_nl_source_free(GWaterNlSource *self);
Expand Down

0 comments on commit 173f2f5

Please sign in to comment.