mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 02:47:56 +08:00
remove FIBER_API in channel.hpp for compiling with no error on Windows & Unix
This commit is contained in:
parent
84f63c9242
commit
0244606e67
@ -184,7 +184,7 @@ static long long __servers_count = 0;
|
||||
static ACL_ATOMIC *__servers_count_atomic = NULL;
|
||||
|
||||
#define SOCK ACL_VSTREAM_SOCK
|
||||
#define MAX_PATH 1024
|
||||
#define MAX 1024
|
||||
|
||||
/* forward functions */
|
||||
|
||||
@ -194,6 +194,9 @@ static void udp_server_read(int event_type, ACL_EVENT *event,
|
||||
|
||||
static void get_addr(const char *addr, char *buf, size_t size)
|
||||
{
|
||||
#ifdef ACL_WINDOWS
|
||||
snprintf(buf, size, "%s", addr);
|
||||
#else
|
||||
if (strchr(addr, ':') != NULL || acl_alldig(addr))
|
||||
snprintf(buf, size, "%s", addr);
|
||||
else
|
||||
@ -201,7 +204,7 @@ static void get_addr(const char *addr, char *buf, size_t size)
|
||||
strcasecmp(acl_var_udp_private, "n") == 0 ?
|
||||
ACL_MASTER_CLASS_PUBLIC : ACL_MASTER_CLASS_PRIVATE,
|
||||
addr);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ACL_LINUX
|
||||
@ -322,7 +325,7 @@ static void netlink_on_changed(void *ctx)
|
||||
ACL_ARGV *addrs = acl_ifconf_search(__service_name);
|
||||
ACL_HTABLE *table = acl_htable_create(10, 0);
|
||||
ACL_ITER iter;
|
||||
char addr[MAX_PATH];
|
||||
char addr[MAX];
|
||||
|
||||
if (addrs == NULL) {
|
||||
acl_msg_error("%s(%d): acl_ifconf_search null, service=%s",
|
||||
@ -618,7 +621,7 @@ static ACL_VSTREAM *server_bind_one(const char *addr)
|
||||
ACL_VSTREAM *stream;
|
||||
ACL_SOCKET fd;
|
||||
unsigned flag = 0;
|
||||
char local[MAX_PATH];
|
||||
char local[MAX];
|
||||
|
||||
if (acl_var_udp_non_block)
|
||||
flag |= ACL_INET_FLAG_NBLOCK;
|
||||
@ -647,7 +650,7 @@ static ACL_VSTREAM *server_bind_one(const char *addr)
|
||||
|
||||
static void server_binding(UDP_SERVER *server, ACL_ARGV *addrs)
|
||||
{
|
||||
char addr[MAX_PATH];
|
||||
char addr[MAX];
|
||||
ACL_ITER iter;
|
||||
int i = 0;
|
||||
|
||||
|
@ -340,14 +340,14 @@ void acl_free_ifaddrs(ACL_IFCONF *ifconf)
|
||||
acl_myfree(ifconf);
|
||||
}
|
||||
|
||||
#define MAX_PATH 1024
|
||||
#define MAX 1024
|
||||
|
||||
static int match_wildcard(const char *pattern, ACL_ARGV *addrs)
|
||||
{
|
||||
const char any[] = "0.0.0.0:";
|
||||
const char domain[] = "@unix";
|
||||
const char udp[] = "@udp";
|
||||
char addr[MAX_PATH];
|
||||
char addr[MAX];
|
||||
ACL_ARGV *tokens;
|
||||
|
||||
#define PREFIX_EQ(x, y) !acl_strncasecmp((x), (y), strlen(y))
|
||||
@ -441,7 +441,7 @@ static void match_addrs_add(const char *pattern, ACL_IFCONF *ifconf,
|
||||
acl_foreach(iter, ifconf) {
|
||||
ACL_IFADDR *ifaddr = (ACL_IFADDR*) iter.data;
|
||||
const char *ip = (const char *) ifaddr->ip;
|
||||
char tmp[MAX_PATH], *colon, addr[MAX_PATH];
|
||||
char tmp[MAX], *colon, addr[MAX];
|
||||
int port;
|
||||
|
||||
/* xxx.xxx.xxx.xxx:port or xxx.xxx.xxx.*:port ...*/
|
||||
|
@ -3,27 +3,26 @@
|
||||
#include "fiber_cpp_define.hpp"
|
||||
|
||||
struct ACL_CHANNEL;
|
||||
extern "C" {
|
||||
extern FIBER_API ACL_CHANNEL *acl_channel_create(int elemsize, int bufsize);
|
||||
extern FIBER_API void acl_channel_free(ACL_CHANNEL *c);
|
||||
extern FIBER_API int acl_channel_send(ACL_CHANNEL *c, void *v);
|
||||
extern FIBER_API int acl_channel_recv(ACL_CHANNEL *c, void *v);
|
||||
}
|
||||
|
||||
namespace acl {
|
||||
|
||||
ACL_CHANNEL *channel_create(int elemsize, int bufsize);
|
||||
void channel_free(ACL_CHANNEL *c);
|
||||
int channel_send(ACL_CHANNEL *c, void *v);
|
||||
int channel_recv(ACL_CHANNEL *c, void *v);
|
||||
|
||||
template <typename T>
|
||||
class channel
|
||||
{
|
||||
public:
|
||||
channel(void)
|
||||
{
|
||||
chan_ = acl_channel_create(sizeof(T), 100);
|
||||
chan_ = channel_create(sizeof(T), 100);
|
||||
}
|
||||
|
||||
~channel(void)
|
||||
{
|
||||
acl_channel_free(chan_);
|
||||
channel_free(chan_);
|
||||
}
|
||||
|
||||
channel& operator << (T& t)
|
||||
@ -33,13 +32,13 @@ public:
|
||||
|
||||
channel& put(T& t)
|
||||
{
|
||||
acl_channel_send(chan_, &t);
|
||||
channel_send(chan_, &t);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void pop(T& t)
|
||||
{
|
||||
acl_channel_recv(chan_, &t);
|
||||
channel_recv(chan_, &t);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -1,2 +1,22 @@
|
||||
#include "stdafx.hpp"
|
||||
#include "fiber/channel.hpp"
|
||||
|
||||
ACL_CHANNEL *channel_create(int elemsize, int bufsize)
|
||||
{
|
||||
return acl_channel_create(elemsize, bufsize);
|
||||
}
|
||||
|
||||
void channel_free(ACL_CHANNEL *c)
|
||||
{
|
||||
return acl_channel_free(c);
|
||||
}
|
||||
|
||||
int channel_send(ACL_CHANNEL *c, void *v)
|
||||
{
|
||||
return acl_channel_send(c, v);
|
||||
}
|
||||
|
||||
int channel_recv(ACL_CHANNEL *c, void *v)
|
||||
{
|
||||
return acl_channel_recv(c, v);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
Summary: The powerful c/c++ library and server framework
|
||||
Name: acl-libs
|
||||
Version: 3.3.0
|
||||
Release: 56
|
||||
Release: 57
|
||||
Group: System/Libs
|
||||
License: IBM
|
||||
URL: http://cdnlog-web.qiyi.domain
|
||||
@ -76,6 +76,9 @@ fi
|
||||
/etc/init.d/master
|
||||
|
||||
%changelog
|
||||
* Tue Jan 16 2018 zhengshuxin@qiyi.com 3.3.0-57-20180116.14
|
||||
- fiber_cpp: remove FIBER_API in including headers
|
||||
|
||||
* Tue Jan 16 2018 zhengshuxin@qiyi.com 3.3.0-56-20180116.14
|
||||
- increase version for building rpm
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user