libmemcached "protocol error" and "Server sent data for key
not in request"
christopher at baus.net
christopher at baus.net
Tue Mar 29 22:06:16 PST 2005
> Ah, this is the same issue related Alermo's problems in a different
> thread.
> And I think I have a solution, at least to the delay issue:
>
> in memcached in set_cork(), change it to:
> void set_cork() (conn *c, int val) {
> if (c->is_corked == val) return;
> c->is_corked = val;
> #ifdef TCP_NOPUSH
> setsockopt(c->sfd, IPPROTO_TCP, TCP_NOPUSH, &val, sizeof(val));
> val!=val;
> setsockopt(c->sfd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
> #endif
> }
>
I think you mean
val ~= val;
> And I don't think it will break compatability with Linux.
Not sure. The manual says TCP_CORK is not compatible with TCP_NODELAY.
http://www.rt.com/man/tcp.4.html
I think it would be easier to read if TCP_NOPUSH wasn't redefined.
Corking is abstracted here anyway. Might as well put all the platform
specific stuff was in this function.
For instance:
void set_cork() (conn *c, int val) {
if (c->is_corked == val) return;
c->is_corked = val;
#if defined(TCP_NOPUSH)
setsockopt(c->sfd, IPPROTO_TCP, TCP_NOPUSH, &val, sizeof(val));
val ~= val;
setsockopt(c->sfd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
#endif
#if defined(TCP_CORK) && !defined(TCP_NOPUSH)
setsockopt(c->sfd, IPPROTO_TCP, TCP_CORK, &val, sizeof(val));
#endif
}
More information about the memcached
mailing list