Commit 165e2778 authored by Dafydd Harries's avatar Dafydd Harries

udp: pass socket manager to socket init function

darcs-hash:20070111120203-c9803-35d33e058d7479f2d7ea0f67fbc8f25ec0fe912c.gz
parent 9bc6da29
......@@ -17,7 +17,7 @@ main (void)
udp_socket_manager_init (&man);
if (!man.init (&sock, NULL))
if (!man.init (&man, &sock, NULL))
g_assert_not_reached ();
if (inet_pton (AF_INET, "127.0.0.1", &(sin.sin_addr)) < 0)
......
......@@ -17,7 +17,7 @@ main (void)
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons (9999);
if (!man.init (&sock, &sin))
if (!man.init (&man, &sock, &sin))
g_assert_not_reached ();
for (;;)
......
......@@ -63,7 +63,10 @@ udp_socket_close (struct UDPSocket *sock)
* port bound to will be set in sock->port.
*/
static gboolean
udp_socket_manager_init_socket (struct UDPSocket *sock, struct sockaddr_in *sin)
udp_socket_manager_init_socket (
struct UDPSocketManager *man,
struct UDPSocket *sock,
struct sockaddr_in *sin)
{
gint sockfd;
struct sockaddr_in name;
......
......@@ -18,7 +18,8 @@ typedef gboolean (*UDPPacketRecvFunc) (struct sockaddr_in *from, guint len,
struct UDPSocketManager
{
gboolean (*init) (struct UDPSocket *sock, struct sockaddr_in *sin);
gboolean (*init) (struct UDPSocketManager *man, struct UDPSocket *sock,
struct sockaddr_in *sin);
void (*select) (UDPPacketRecvFunc cb);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment