Library rabbitmq_c and TCP_NODELAY

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Library rabbitmq_c and TCP_NODELAY

Haster
Hi Alan,

In my program I use TCP_NODELAY option of socket.
And now my code look like:

      connection = amqp_new_connection();
      if (!connection) {
        throw RabbitMQException(-1, "Create connection error");
      }
      int sockfd = amqp_open_socket(hostName.c_str(), portNumber);  //5672
      if (sockfd < 0) {
        std::string err_msg = "Opening socket: ";
        err_msg += amqp_error_string2(sockfd);
        throw RabbitMQException(-sockfd, err_msg.c_str());
      }
      int nodelay = 1;
      setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char*)&nodelay, sizeof(nodelay));
      amqp_set_sockfd(connection, sockfd);

But amqp_set_sockfd function is deprecated now and I'm afraid that it can be dropped in future versions.
So can you add supporting TCP_NODELAY option in your future version of rabbitmq_c?
Reply | Threaded
Open this post in threaded view
|

Library rabbitmq_c and TCP_NODELAY

alan.antonuk
By default rabbitmq-c sets TCP_NODELAY on:

https://github.com/alanxz/rabbitmq-c/blob/master/librabbitmq/amqp_socket.c#L328

There should be no reason for you to be changing this socket parameter.

-Alan

On Wed May 21 2014 at 11:17:40 PM, Haster <[hidden email]> wrote:
Hi Alan,

In my program I use TCP_NODELAY option of socket.
And now my code look like:

      connection = amqp_new_connection();
      if (!connection) {
        throw RabbitMQException(-1, "Create connection error");
      }
      int sockfd = amqp_open_socket(hostName.c_str(), portNumber);  //5672
      if (sockfd < 0) {
        std::string err_msg = "Opening socket: ";
        err_msg += amqp_error_string2(sockfd);
        throw RabbitMQException(-sockfd, err_msg.c_str());
      }
      int nodelay = 1;
      setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char*)&nodelay,
sizeof(nodelay));
      amqp_set_sockfd(connection, sockfd);

But amqp_set_sockfd function is deprecated now and I'm afraid that it can be
dropped in future versions.
So can you add supporting TCP_NODELAY option in your future version of
rabbitmq_c?



--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/Library-rabbitmq-c-and-TCP-NODELAY-tp35761.html
Sent from the RabbitMQ mailing list archive at Nabble.com.
_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Library rabbitmq_c and TCP_NODELAY

Haster
Oh, It's my fault =)
Alan, thanks for reply!