#define DEBUG_CONNECTION GNUNET_NO
-
/**
* Possible functions to call after connect failed or succeeded.
*/
struct GNUNET_CONNECTION_Handle
{
- /**
- * Scheduler that was used for the connect task.
- */
- struct GNUNET_SCHEDULER_Handle *sched;
-
/**
* Configuration to use.
*/
sock->persist = GNUNET_YES;
}
+
+/**
+ * Disable the "CORK" feature for communication with the given socket,
+ * forcing the OS to immediately flush the buffer on transmission
+ * instead of potentially buffering multiple messages. Essentially
+ * reduces the OS send buffers to zero.
+ * Used to make sure that the last messages sent through the connection
+ * reach the other side before the process is terminated.
+ *
+ * @param sock the connection to make flushing and blocking
+ * @return GNUNET_OK on success
+ */
+int GNUNET_CONNECTION_disable_corking (struct GNUNET_CONNECTION_Handle *sock)
+{
+ return GNUNET_NETWORK_socket_disable_corking (sock->sock);
+}
+
/**
* Create a socket handle by boxing an existing OS socket. The OS
* socket should henceforth be no longer used directly.
* GNUNET_socket_destroy will close it.
*
- * @param sched scheduler to use
* @param osSocket existing socket to box
* @return the boxed socket handle
*/
struct GNUNET_CONNECTION_Handle *
-GNUNET_CONNECTION_create_from_existing (struct GNUNET_SCHEDULER_Handle
- *sched,
- struct GNUNET_NETWORK_Handle
+GNUNET_CONNECTION_create_from_existing (struct GNUNET_NETWORK_Handle
*osSocket)
{
struct GNUNET_CONNECTION_Handle *ret;
ret->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE;
ret->write_buffer = GNUNET_malloc(ret->write_buffer_size);
ret->sock = osSocket;
- ret->sched = sched;
return ret;
}
* Create a socket handle by accepting on a listen socket. This
* function may block if the listen socket has no connection ready.
*
- * @param sched scheduler to use
* @param access function to use to check if access is allowed
* @param access_cls closure for access
* @param lsock listen socket
* @return the socket handle, NULL on error
*/
struct GNUNET_CONNECTION_Handle *
-GNUNET_CONNECTION_create_from_accept (struct GNUNET_SCHEDULER_Handle
- *sched,
- GNUNET_CONNECTION_AccessCheck access,
+GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access,
void *access_cls,
struct GNUNET_NETWORK_Handle *lsock)
{
struct sockaddr_in6 *v6;
struct sockaddr *sa;
void *uaddr;
+ struct GNUNET_CONNECTION_Credentials *gcp;
+ struct GNUNET_CONNECTION_Credentials gc;
+#ifdef SO_PEERCRED
+ struct ucred uc;
+ socklen_t olen;
+#endif
addrlen = sizeof (addr);
sock =
v4 = GNUNET_malloc (sizeof (struct sockaddr_in));
memset (v4, 0, sizeof (struct sockaddr_in));
v4->sin_family = AF_INET;
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ v4->sin_len = (u_char) sizeof (struct sockaddr_in);
+#endif
memcpy (&v4->sin_addr,
&((char *) &v6->sin6_addr)[sizeof (struct in6_addr) -
sizeof (struct in_addr)],
uaddr = GNUNET_malloc (addrlen);
memcpy (uaddr, addr, addrlen);
}
+ gcp = NULL;
+ gc.uid = 0;
+ gc.gid = 0;
+ if (sa->sa_family == AF_UNIX)
+ {
+#if HAVE_GETPEEREID
+ /* most BSDs */
+ if (0 == getpeereid (GNUNET_NETWORK_get_fd (sock),
+ &gc.uid,
+ &gc.gid))
+ gcp = &gc;
+#else
+#ifdef SO_PEERCRED
+ /* largely traditional GNU/Linux */
+ olen = sizeof (uc);
+ if ( (0 ==
+ getsockopt (GNUNET_NETWORK_get_fd (sock),
+ SOL_SOCKET, SO_PEERCRED, &uc, &olen)) &&
+ (olen == sizeof (uc)) )
+ {
+ gc.uid = uc.uid;
+ gc.gid = uc.gid;
+ gcp = &gc;
+ }
+#else
+#if HAVE_GETPEERUCRED
+ /* this is for Solaris 10 */
+ ucred_t *uc;
+
+ uc = NULL;
+ if (0 == getpeerucred (GNUNET_NETWORK_get_fd (sock), &uc))
+ {
+ gc.uid = ucred_geteuid (uc);
+ gc.gid = ucred_getegid (uc);
+ gcp = &gc;
+ }
+ ucred_free (uc);
+#endif
+#endif
+#endif
+ }
if ((access != NULL) &&
- (GNUNET_YES != (aret = access (access_cls, uaddr, addrlen))))
+ (GNUNET_YES != (aret = access (access_cls, gcp, uaddr, addrlen))))
{
if (aret == GNUNET_NO)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
ret->addr = uaddr;
ret->addrlen = addrlen;
ret->sock = sock;
- ret->sched = sched;
#if DEBUG_CONNECTION
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Accepting connection from `%s': %p\n"),
struct GNUNET_CONNECTION_Handle *sock = cls;
GNUNET_CONNECTION_TransmitReadyNotify notify;
struct AddressProbe *pos;
-
+
sock->destroy_task = GNUNET_SCHEDULER_NO_TASK;
GNUNET_assert (sock->dns_active == NULL);
if (0 != (sock->ccs & COCO_TRANSMIT_READY))
#endif
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == sock->destroy_task);
sock->destroy_task
- = GNUNET_SCHEDULER_add_after (sock->sched,
- sock->write_task,
+ = GNUNET_SCHEDULER_add_after (sock->write_task,
&destroy_continuation, sock);
return;
}
"Shutting down socket (%p)\n", sock);
#endif
if (sock->persist != GNUNET_YES)
- GNUNET_NETWORK_socket_shutdown (sock->sock, SHUT_RDWR);
+ {
+ if ( (GNUNET_YES != GNUNET_NETWORK_socket_shutdown (sock->sock, SHUT_RDWR)) &&
+ (errno != ENOTCONN) &&
+ (errno != ECONNRESET) )
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "shutdown");
+ }
}
if (sock->read_task != GNUNET_SCHEDULER_NO_TASK)
{
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == sock->destroy_task);
sock->destroy_task
- = GNUNET_SCHEDULER_add_after (sock->sched,
- sock->read_task,
+ = GNUNET_SCHEDULER_add_after (sock->read_task,
&destroy_continuation, sock);
return;
}
while (NULL != (pos = sock->ap_head))
{
GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (pos->sock));
- GNUNET_SCHEDULER_cancel (sock->sched, pos->task);
+ GNUNET_SCHEDULER_cancel (pos->task);
GNUNET_CONTAINER_DLL_remove (sock->ap_head, sock->ap_tail, pos);
GNUNET_free (pos);
}
h);
#endif
h->ccs -= COCO_RECEIVE_AGAIN;
- h->read_task = GNUNET_SCHEDULER_add_after (h->sched,
- GNUNET_SCHEDULER_NO_TASK,
- &receive_again, h);
+ h->read_task = GNUNET_SCHEDULER_add_now (&receive_again, h);
}
if (0 != (h->ccs & COCO_TRANSMIT_READY))
{
h);
#endif
GNUNET_assert (h->nth.timeout_task != GNUNET_SCHEDULER_NO_TASK);
- GNUNET_SCHEDULER_cancel (h->sched, h->nth.timeout_task);
+ GNUNET_SCHEDULER_cancel (h->nth.timeout_task);
h->nth.timeout_task = GNUNET_SCHEDULER_NO_TASK;
h->ccs -= COCO_TRANSMIT_READY;
+ GNUNET_assert (h->nth.notify_ready != NULL);
GNUNET_assert (h->write_task == GNUNET_SCHEDULER_NO_TASK);
- h->write_task = GNUNET_SCHEDULER_add_after (h->sched,
- GNUNET_SCHEDULER_NO_TASK,
- &transmit_ready, h);
+ h->write_task = GNUNET_SCHEDULER_add_now (&transmit_ready, h);
}
if (0 != (h->ccs & COCO_DESTROY_CONTINUATION))
{
h->ccs -= COCO_DESTROY_CONTINUATION;
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->destroy_task);
h->destroy_task
- = GNUNET_SCHEDULER_add_now (h->sched,
- &destroy_continuation,
+ = GNUNET_SCHEDULER_add_now (&destroy_continuation,
h);
}
}
h);
#endif
h->ccs -= COCO_RECEIVE_AGAIN;
- h->read_task = GNUNET_SCHEDULER_add_after (h->sched,
- GNUNET_SCHEDULER_NO_TASK,
- &receive_again, h);
+ h->read_task = GNUNET_SCHEDULER_add_now (&receive_again, h);
}
if (0 != (h->ccs & COCO_TRANSMIT_READY))
{
h);
#endif
GNUNET_assert (h->nth.timeout_task != GNUNET_SCHEDULER_NO_TASK);
- GNUNET_SCHEDULER_cancel (h->sched, h->nth.timeout_task);
+ GNUNET_SCHEDULER_cancel (h->nth.timeout_task);
h->nth.timeout_task = GNUNET_SCHEDULER_NO_TASK;
h->ccs -= COCO_TRANSMIT_READY;
GNUNET_assert (h->write_task == GNUNET_SCHEDULER_NO_TASK);
+ GNUNET_assert (h->nth.notify_ready != NULL);
h->write_task =
- GNUNET_SCHEDULER_add_write_net (h->sched,
- GNUNET_TIME_absolute_get_remaining
+ GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_absolute_get_remaining
(h->nth.transmit_timeout), h->sock,
&transmit_ready, h);
}
h->ccs -= COCO_DESTROY_CONTINUATION;
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->destroy_task);
h->destroy_task
- = GNUNET_SCHEDULER_add_now (h->sched,
- &destroy_continuation,
- h);
+ = GNUNET_SCHEDULER_add_now (&destroy_continuation,
+ h);
}
}
struct GNUNET_CONNECTION_Handle *h = ap->h;
struct AddressProbe *pos;
int error;
- unsigned int len;
+ socklen_t len;
GNUNET_assert (ap->sock != NULL);
GNUNET_CONTAINER_DLL_remove (h->ap_head, h->ap_tail, ap);
while (NULL != (pos = h->ap_head))
{
GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (pos->sock));
- GNUNET_SCHEDULER_cancel (h->sched, pos->task);
+ GNUNET_SCHEDULER_cancel (pos->task);
GNUNET_CONTAINER_DLL_remove (h->ap_head, h->ap_tail, pos);
GNUNET_free (pos);
}
GNUNET_TIME_absolute_get_remaining
(h->receive_timeout));
ap->task =
- GNUNET_SCHEDULER_add_write_net (h->sched, delay, ap->sock,
+ GNUNET_SCHEDULER_add_write_net (delay, ap->sock,
&connect_probe_continuation, ap);
}
* This function returns immediately, even if the connection has not
* yet been established. This function only creates TCP connections.
*
- * @param sched scheduler to use
* @param cfg configuration to use
* @param hostname name of the host to connect to
* @param port port to connect to
* @return the socket handle
*/
struct GNUNET_CONNECTION_Handle *
-GNUNET_CONNECTION_create_from_connect (struct GNUNET_SCHEDULER_Handle *sched,
- const struct
+GNUNET_CONNECTION_create_from_connect (const struct
GNUNET_CONFIGURATION_Handle *cfg,
const char *hostname, uint16_t port)
{
GNUNET_assert (0 < strlen (hostname)); /* sanity check */
ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle));
ret->cfg = cfg;
- ret->sched = sched;
ret->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE;
ret->write_buffer = GNUNET_malloc(ret->write_buffer_size);
ret->port = port;
ret->hostname = GNUNET_strdup (hostname);
- ret->dns_active = GNUNET_RESOLVER_ip_get (sched,
- cfg,
- ret->hostname,
+ ret->dns_active = GNUNET_RESOLVER_ip_get (ret->hostname,
AF_UNSPEC,
GNUNET_CONNECTION_CONNECT_RETRY_TIMEOUT,
&try_connect_using_address, ret);
* This function returns immediately, even if the connection has not
* yet been established. This function only creates UNIX connections.
*
- * @param sched scheduler to use
* @param cfg configuration to use
* @param unixpath path to connect to
* @return the socket handle, NULL on systems without UNIX support
*/
struct GNUNET_CONNECTION_Handle *
-GNUNET_CONNECTION_create_from_connect_to_unixpath (struct GNUNET_SCHEDULER_Handle *sched,
- const struct
+GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct
GNUNET_CONFIGURATION_Handle *cfg,
const char *unixpath)
{
GNUNET_assert (0 < strlen (unixpath)); /* sanity check */
un = GNUNET_malloc (sizeof (struct sockaddr_un));
un->sun_family = AF_UNIX;
- slen = strlen (unixpath) + 1;
+ slen = strlen (unixpath);
if (slen >= sizeof (un->sun_path))
slen = sizeof (un->sun_path) - 1;
memcpy (un->sun_path,
unixpath,
slen);
un->sun_path[slen] = '\0';
- slen += sizeof (sa_family_t);
+ slen = sizeof (struct sockaddr_un);
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ un->sun_len = (u_char) slen;
+#endif
#if LINUX
un->sun_path[0] = '\0';
- slen = sizeof (struct sockaddr_un);
#endif
ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle));
ret->cfg = cfg;
- ret->sched = sched;
ret->write_buffer_size = GNUNET_SERVER_MIN_BUFFER_SIZE;
ret->write_buffer = GNUNET_malloc(ret->write_buffer_size);
ret->port = 0;
ret->addr,
ret->addrlen))
{
+ /* Just return; we expect everything to work eventually so don't fail HARD */
GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (ret->sock));
- GNUNET_free (ret->addr);
- GNUNET_free (ret->write_buffer);
- GNUNET_free (ret);
- return NULL;
+ ret->sock = NULL;
+ return ret;
}
connect_success_continuation (ret);
return ret;
* This function returns immediately, even if the connection has not
* yet been established. This function only creates TCP connections.
*
- * @param sched scheduler to use
* @param af_family address family to use
* @param serv_addr server address
* @param addrlen length of server address
* @return the socket handle
*/
struct GNUNET_CONNECTION_Handle *
-GNUNET_CONNECTION_create_from_sockaddr (struct GNUNET_SCHEDULER_Handle
- *sched, int af_family,
+GNUNET_CONNECTION_create_from_sockaddr (int af_family,
const struct sockaddr *serv_addr,
socklen_t addrlen)
{
struct GNUNET_NETWORK_Handle *s;
struct GNUNET_CONNECTION_Handle *ret;
+
s = GNUNET_NETWORK_socket_create (af_family, SOCK_STREAM, 0);
if (s == NULL)
{
{
/* maybe refused / unsupported address, try next */
GNUNET_log_strerror (GNUNET_ERROR_TYPE_INFO, "connect");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ _("Attempt to connect to `%s' failed\n"),
+ GNUNET_a2s (serv_addr, addrlen));
GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (s));
return NULL;
}
- ret = GNUNET_CONNECTION_create_from_existing (sched, s);
+ ret = GNUNET_CONNECTION_create_from_existing (s);
ret->addr = GNUNET_malloc (addrlen);
memcpy (ret->addr, serv_addr, addrlen);
ret->addrlen = addrlen;
{
if (sock->write_task != GNUNET_SCHEDULER_NO_TASK)
{
- GNUNET_SCHEDULER_cancel (sock->sched,
- sock->write_task);
+ GNUNET_SCHEDULER_cancel (sock->write_task);
sock->write_task = GNUNET_SCHEDULER_NO_TASK;
sock->write_buffer_off = 0;
}
+ sock->nth.notify_ready = NULL;
}
if ((sock->write_buffer_off == 0) && (sock->dns_active != NULL))
{
GNUNET_RESOLVER_request_cancel (sock->dns_active);
sock->dns_active = NULL;
}
- GNUNET_assert (sock->sched != NULL);
+
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == sock->destroy_task);
sock->destroy_task
- = GNUNET_SCHEDULER_add_now (sock->sched,
- &destroy_continuation, sock);
+ = GNUNET_SCHEDULER_add_now (&destroy_continuation, sock);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Ignoring shutdown signal per configuration\n");
#endif
- sh->read_task = GNUNET_SCHEDULER_add_read_net (tc->sched,
- GNUNET_TIME_absolute_get_remaining
+ sh->read_task = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_absolute_get_remaining
(sh->receive_timeout),
sh->sock,
&receive_ready, sh);
return;
}
now = GNUNET_TIME_absolute_get ();
- if ((now.value > sh->receive_timeout.value) ||
+ if ((now.abs_value > sh->receive_timeout.abs_value) ||
(0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) ||
(0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)))
{
"Receive from `%s' encounters error: time out by %llums... (%p)\n",
GNUNET_a2s (sh->addr, sh->addrlen),
GNUNET_TIME_absolute_get_duration (sh->receive_timeout).
- value, sh);
+ rel_value, sh);
#endif
signal_timeout (sh);
return;
return;
}
now = GNUNET_TIME_absolute_get ();
- if ((now.value > sh->receive_timeout.value) ||
+ if ((now.abs_value > sh->receive_timeout.abs_value) ||
(0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)))
{
#if DEBUG_CONNECTION
}
GNUNET_assert (sh->sock != NULL);
/* connect succeeded, wait for data! */
- sh->read_task = GNUNET_SCHEDULER_add_read_net (tc->sched,
- GNUNET_TIME_absolute_get_remaining
+ sh->read_task = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_absolute_get_remaining
(sh->receive_timeout),
sh->sock,
&receive_ready, sh);
if (sock->sock != NULL)
{
memset (&tc, 0, sizeof (tc));
- tc.sched = sock->sched;
tc.reason = GNUNET_SCHEDULER_REASON_PREREQ_DONE;
receive_again (sock, &tc);
return;
{
if (sock->read_task != GNUNET_SCHEDULER_NO_TASK)
{
- GNUNET_assert (sock == GNUNET_SCHEDULER_cancel (sock->sched,
- sock->read_task));
+ GNUNET_assert (sock == GNUNET_SCHEDULER_cancel (sock->read_task));
sock->read_task = GNUNET_SCHEDULER_NO_TASK;
}
else
* expired).
*
* This task notifies the client about the timeout.
+ *
+ * @param cls the 'struct GNUNET_CONNECTION_Handle'
+ * @param tc scheduler context
*/
static void
-transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_timeout (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_CONNECTION_Handle *sock = cls;
GNUNET_CONNECTION_TransmitReadyNotify notify;
* at the time of being asked to transmit.
*
* This task notifies the client about the error.
+ *
+ * @param cls the 'struct GNUNET_CONNECTION_Handle'
+ * @param tc scheduler context
*/
static void
-connect_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+connect_error (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_CONNECTION_Handle *sock = cls;
GNUNET_CONNECTION_TransmitReadyNotify notify;
#if DEBUG_CONNECTION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transmission request of size %u fails, connection failed (%p).\n",
- sock->nth.notify_size, sock);
+ "Transmission request of size %u fails (%s/%u), connection failed (%p).\n",
+ sock->nth.notify_size,
+ sock->hostname,
+ sock->port,
+ sock);
#endif
sock->write_task = GNUNET_SCHEDULER_NO_TASK;
notify = sock->nth.notify_ready;
}
+/**
+ * FIXME
+ *
+ * @param sock FIXME
+ */
static void
transmit_error (struct GNUNET_CONNECTION_Handle *sock)
{
}
if (sock->read_task != GNUNET_SCHEDULER_NO_TASK)
{
- GNUNET_SCHEDULER_cancel (sock->sched,
- sock->read_task);
+ GNUNET_SCHEDULER_cancel (sock->read_task);
sock->read_task = GNUNET_SCHEDULER_NO_TASK;
signal_timeout (sock);
return;
GNUNET_a2s (sock->addr, sock->addrlen), sock);
#endif
notify = sock->nth.notify_ready;
- sock->nth.notify_ready = NULL;
- notify (sock->nth.notify_ready_cls, 0, NULL);
+ if (NULL != notify)
+ {
+ sock->nth.notify_ready = NULL;
+ notify (sock->nth.notify_ready_cls, 0, NULL);
+ }
return;
}
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT))
GNUNET_a2s (sock->addr, sock->addrlen), sock);
#endif
notify = sock->nth.notify_ready;
+ GNUNET_assert (NULL != notify);
sock->nth.notify_ready = NULL;
notify (sock->nth.notify_ready_cls, 0, NULL);
return;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Re-scheduling transmit_ready (more to do) (%p).\n", sock);
#endif
+ have = sock->write_buffer_off - sock->write_buffer_pos;
+ GNUNET_assert ( (sock->nth.notify_ready != NULL) || (have > 0) );
if (sock->write_task == GNUNET_SCHEDULER_NO_TASK)
sock->write_task =
- GNUNET_SCHEDULER_add_write_net (tc->sched,
- GNUNET_TIME_absolute_get_remaining
- (sock->nth.transmit_timeout),
- sock->sock, &transmit_ready, sock);
+ GNUNET_SCHEDULER_add_write_net ((sock->nth.notify_ready == NULL)
+ ? GNUNET_TIME_UNIT_FOREVER_REL
+ : GNUNET_TIME_absolute_get_remaining (sock->nth.transmit_timeout),
+ sock->sock,
+ &transmit_ready, sock);
}
notify, void *notify_cls)
{
if (sock->nth.notify_ready != NULL)
- return NULL;
+ {
+ GNUNET_assert (0);
+ return NULL;
+ }
GNUNET_assert (notify != NULL);
GNUNET_assert (size < GNUNET_SERVER_MAX_MESSAGE_SIZE);
GNUNET_assert (sock->write_buffer_off <= sock->write_buffer_size);
(sock->ap_head == NULL) && (sock->dns_active == NULL))
{
if (sock->write_task != GNUNET_SCHEDULER_NO_TASK)
- GNUNET_SCHEDULER_cancel (sock->sched,
- sock->write_task);
- sock->write_task = GNUNET_SCHEDULER_add_now (sock->sched,
- &connect_error, sock);
+ GNUNET_SCHEDULER_cancel (sock->write_task);
+ sock->write_task = GNUNET_SCHEDULER_add_now (&connect_error, sock);
return &sock->nth;
}
if (GNUNET_SCHEDULER_NO_TASK != sock->write_task)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Scheduling transmit_ready (%p).\n", sock);
#endif
- sock->write_task = GNUNET_SCHEDULER_add_write_net (sock->sched,
- GNUNET_TIME_absolute_get_remaining
+ sock->write_task = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_absolute_get_remaining
(sock->nth.
transmit_timeout),
sock->sock,
sock);
#endif
sock->ccs |= COCO_TRANSMIT_READY;
- sock->nth.timeout_task = GNUNET_SCHEDULER_add_delayed (sock->sched,
- timeout,
+ sock->nth.timeout_task = GNUNET_SCHEDULER_add_delayed (timeout,
&transmit_timeout,
sock);
}
/**
- * Cancel the specified transmission-ready
- * notification.
+ * Cancel the specified transmission-ready notification.
+ *
+ * @param th notification to cancel
*/
void
GNUNET_CONNECTION_notify_transmit_ready_cancel (struct
"notify_transmit_ready_cancel cancels timeout_task (%p)\n",
h);
#endif
- GNUNET_SCHEDULER_cancel (h->sh->sched, h->timeout_task);
+ GNUNET_SCHEDULER_cancel (h->timeout_task);
h->timeout_task = GNUNET_SCHEDULER_NO_TASK;
h->sh->ccs -= COCO_TRANSMIT_READY;
}
{
if (h->sh->write_task != GNUNET_SCHEDULER_NO_TASK)
{
- GNUNET_SCHEDULER_cancel (h->sh->sched, h->sh->write_task);
+ GNUNET_SCHEDULER_cancel (h->sh->write_task);
h->sh->write_task = GNUNET_SCHEDULER_NO_TASK;
}
}