[nanomsg] Abort on recoverable error?

  • From: Jihyun Yu <yjh0502@xxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Tue, 2 Sep 2014 14:49:48 +0900

Hi,

It seems that nanomsg aborts on recoverable error. For example
following code fails with abort();

==
#include <nanomsg/nn.h>
#include <nanomsg/pubsub.h>

int main(void) {
    int socket = nn_socket(AF_SP, NN_PUB);
    if(socket < 0) return socket;
    int tp1 = nn_bind(socket, "tcp://*:11234");
    if(tp1 < 0) return tp1;
    int tp2 = nn_bind(socket, "tcp://*:11234");
    if(tp2 < 0) return tp2;

    return 0;
}
==

Here's an output

==
Address already in use [98] (src/transports/tcp/btcp.c:378)
/bin/bash: line 1: 22624 Aborted                 ./a.out
==

I'm writing Erlang binding of nanomsg[1], and calling abort() inside
library functions is not acceptable in Erlang. Is the design
intentional?


[1] https://github.com/yjh0502/nanomsg

Other related posts: