Function amqp_set_handshake_timeout

Synopsis

#include <librabbitmq/amqp.h>

int amqp_set_handshake_timeout(amqp_connection_state_t state, const struct timeval *timeout)

Description

Set the login handshake timeout.

amqp_login and amqp_login_with_properties perform the login handshake with the broker. This function sets the timeout associated with completing this operation from the client side.

The timeout must be set before amqp_login or amqp_login_with_properties is called to change from the default timeout.

Note that the RabbitMQ broker has a configurable timeout for completing the login handshake, the default is 10 seconds. rabbitmq-c has a default of 12 seconds.

Parameters:

[ in ] state - the connection object

[ in ] timeout - a struct timeval* representing new login timeout for the state object. NULL represents an infinite timeout. The value of timeout is copied internally, the caller is responsible for ownership of the passed in pointer, it does not need to remain valid after this function is called.

Return
AMQP_STATUS_OK on success.
Since
v0.9.0

Source

Lines 365-378 in librabbitmq/amqp_api.c. Line 2476 in librabbitmq/amqp.h.

int amqp_set_handshake_timeout(amqp_connection_state_t state,
                               const struct timeval *timeout) {
  if (timeout) {
    if (timeout->tv_sec < 0 || timeout->tv_usec < 0) {
      return AMQP_STATUS_INVALID_PARAMETER;
    }
    state->internal_handshake_timeout = *timeout;
    state->handshake_timeout = &state->internal_handshake_timeout;
  } else {
    state->handshake_timeout = NULL;
  }

  return AMQP_STATUS_OK;
}





Add Discussion as Guest

Log in to DocsForge