| 70 struct simple_account_data *sip = gc->proto_data; |
70 struct simple_account_data *sip = gc->proto_data; |
| 71 if(sip->udp) { /* in case of UDP send a packet only with a 0 byte to |
71 if(sip->udp) { /* in case of UDP send a packet only with a 0 byte to |
| 72 remain in the NAT table */ |
72 remain in the NAT table */ |
| 73 gchar buf[2] = {0, 0}; |
73 gchar buf[2] = {0, 0}; |
| 74 purple_debug_info("simple", "sending keep alive\n"); |
74 purple_debug_info("simple", "sending keep alive\n"); |
| 75 sendto(sip->fd, buf, 1, 0, (struct sockaddr*)&sip->serveraddr, sizeof(struct sockaddr_in)); |
75 if (sendto(sip->fd, buf, 1, 0, |
| |
76 (struct sockaddr*)&sip->serveraddr, |
| |
77 sizeof(struct sockaddr_in)) != 1) |
| |
78 { |
| |
79 purple_debug_error("simple", "failed sending keep alive\n"); |
| |
80 } |
| 76 } |
81 } |
| 77 return; |
82 return; |
| 78 } |
83 } |
| 79 |
84 |
| 80 static gboolean process_register_response(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc); |
85 static gboolean process_register_response(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc); |
| 1721 newfd = accept(source, NULL, NULL); |
1726 newfd = accept(source, NULL, NULL); |
| 1722 |
1727 |
| 1723 flags = fcntl(newfd, F_GETFL); |
1728 flags = fcntl(newfd, F_GETFL); |
| 1724 fcntl(newfd, F_SETFL, flags | O_NONBLOCK); |
1729 fcntl(newfd, F_SETFL, flags | O_NONBLOCK); |
| 1725 #ifndef _WIN32 |
1730 #ifndef _WIN32 |
| 1726 fcntl(newfd, F_SETFD, FD_CLOEXEC); |
1731 if (fcntl(newfd, F_SETFD, FD_CLOEXEC) != 0) |
| |
1732 purple_debug_warning("simple", "couldn't set FD_CLOEXEC\n"); |
| 1727 #endif |
1733 #endif |
| 1728 |
1734 |
| 1729 conn = connection_create(sip, newfd); |
1735 conn = connection_create(sip, newfd); |
| 1730 |
1736 |
| 1731 conn->inputhandler = purple_input_add(newfd, PURPLE_INPUT_READ, simple_input_cb, gc); |
1737 conn->inputhandler = purple_input_add(newfd, PURPLE_INPUT_READ, simple_input_cb, gc); |