diff options
Diffstat (limited to 'src/cadet/cadet_api.c')
-rw-r--r-- | src/cadet/cadet_api.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index decf473a9..3fdeffe13 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c | |||
@@ -1583,7 +1583,7 @@ GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
1583 | * @param window_changes Function called when the transmit window size changes. | 1583 | * @param window_changes Function called when the transmit window size changes. |
1584 | * @param disconnects Function called when a channel is disconnected. | 1584 | * @param disconnects Function called when a channel is disconnected. |
1585 | * @param handlers Callbacks for messages we care about, NULL-terminated. | 1585 | * @param handlers Callbacks for messages we care about, NULL-terminated. |
1586 | * @return Port handle. | 1586 | * @return Port handle, NULL if port is in use |
1587 | */ | 1587 | */ |
1588 | struct GNUNET_CADET_Port * | 1588 | struct GNUNET_CADET_Port * |
1589 | GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h, | 1589 | GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h, |
@@ -1604,17 +1604,21 @@ GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h, | |||
1604 | p = GNUNET_new (struct GNUNET_CADET_Port); | 1604 | p = GNUNET_new (struct GNUNET_CADET_Port); |
1605 | p->cadet = h; | 1605 | p->cadet = h; |
1606 | p->id = *port; | 1606 | p->id = *port; |
1607 | if (GNUNET_OK != | ||
1608 | GNUNET_CONTAINER_multihashmap_put (h->ports, | ||
1609 | &p->id, | ||
1610 | p, | ||
1611 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) | ||
1612 | { | ||
1613 | GNUNET_free (p); | ||
1614 | return NULL; | ||
1615 | } | ||
1607 | p->connects = connects; | 1616 | p->connects = connects; |
1608 | p->cls = connects_cls; | 1617 | p->cls = connects_cls; |
1609 | p->window_changes = window_changes; | 1618 | p->window_changes = window_changes; |
1610 | p->disconnects = disconnects; | 1619 | p->disconnects = disconnects; |
1611 | p->handlers = GNUNET_MQ_copy_handlers (handlers); | 1620 | p->handlers = GNUNET_MQ_copy_handlers (handlers); |
1612 | 1621 | ||
1613 | GNUNET_assert (GNUNET_OK == | ||
1614 | GNUNET_CONTAINER_multihashmap_put (h->ports, | ||
1615 | &p->id, | ||
1616 | p, | ||
1617 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
1618 | 1622 | ||
1619 | env = GNUNET_MQ_msg (msg, | 1623 | env = GNUNET_MQ_msg (msg, |
1620 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN); | 1624 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN); |