[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] A patch for evrpc, allowing extra argument of request_new and reply_new
- To: libevent-users@xxxxxxxx
- Subject: [Libevent-users] A patch for evrpc, allowing extra argument of request_new and reply_new
- From: Shuo Chen <giantchen@xxxxxxxxx>
- Date: Sun, 21 Mar 2010 12:21:17 +0800
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Sun, 21 Mar 2010 00:21:49 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:from:date:received :message-id:subject:to:content-type; bh=I/BZCIXmO+1V8NV4HAWSN8Y9cpee9/+PUXWszUPjLjw=; b=iL4gr9MYQzmTAS8fYHFLacQUKoTW2PZfIQRA16T+2cjSOVfAurnWIqsNxv5GcjFNDa 4ZeNJbI4PpFd6hXaijUlzmCFS6TrKrgJ0HGN5FVv1LemnAXzz1jfed6FmCtwYvznXzxr uLQ7M2gxxRAyPW12jl/QW4YMO0TKTLtM+XRpM=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=nrtbedDnheZhyyKFb03zp7xhf+viXY+mx27JBvQ6mGNjVRI3qjF95muYPS/swPQGar rAGvOQ6xnAd6ny976gn/B3UQRpGUNrCHFAYTbZjljjWtQHTeMxpWN2rEDdwhsDTvbDnV gak+reE2GThAZ3DOVZiNiDblw0+l6jkf4c3Zg=
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
Hi,
I am trying to implement google protocol buffers rpc on top of libevent2 rpc.
http://code.google.com/p/evproto
// Not finishing yet.
Now each message defined in YYY.rpc has its own XXX_new function for
malloc'ing and initializing the struct.
The function addresses are kept in in 'struct evrpc':
struct evrpc {
/* creates a new request structure */
void *(*request_new)(void);
/* creates a new reply structure */
void *(*reply_new)(void);
}
If we add an extra 'void*' argument to each of these functions,
libevent2 rpc could be easily integrated with google protocol buffers.
struct evrpc {
/* creates a new request structure */
! void *(*request_new)(void *);
+ void *request_new_arg;
/* creates a new reply structure */
! void *(*reply_new)(void *);
+ void *reply_new_arg;
}
We don't have to write a protocol buffer compiler plug-in for
generating libevent2 specific backend code, but simply sub-classing
protobuf::RpcChannel and protobuf::RpcController, and overriding
some virtual functions would do the work.
I've made a patch file, which updates other parts as well.
http://evproto.googlecode.com/svn/trunk/libevent-2.0.4-alpha-protobuf-rpc.patch
It passes regression test, and doesn't break the current usage I think,
just to rerun event_rpcgen.py and recompile the code.
Is it possible to make it official ?
Regards,
Shuo Chen
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.