Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added better error reporting in protocol, and adding pom.xml for clojars

  • Loading branch information...
commit fc8ca65daaa6511b004849b07b8f9159d1f9c35c 1 parent 5e37b5b
Jason Jackson authored
View
2  config/development.scala
@@ -11,7 +11,7 @@ new KestrelConfig {
queuePath = "/var/spool/kestrel"
- clientTimeout = 30.seconds
+ clientTimeout = 0.second
expirationTimerFrequency = 1.second
View
48 pom.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.clojars.jasonjckn</groupId>
+ <artifactId>kestrel</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <name>kestrel</name>
+ <scm>
+ <tag>5e37b5bf7b91f0e1c820ab6c8cc3fb4d117d19d6</tag>
+ </scm>
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+ <testSourceDirectory>test</testSourceDirectory>
+ <resources>
+ <resource>
+ <directory>resources</directory>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>test-resources</directory>
+ </testResource>
+ </testResources>
+ </build>
+ <repositories>
+ <repository>
+ <id>central</id>
+ <url>http://repo1.maven.org/maven2</url>
+ </repository>
+ <repository>
+ <id>clojure</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojure-snapshots</id>
+ <url>http://build.clojure.org/snapshots</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+ </repositories>
+</project>
+
+<!-- This file was autogenerated by the Leiningen build tool.
+ Please do not edit it directly; instead edit project.clj and regenerate it.
+ It should not be considered canonical data. For more information see
+ https://github.com/technomancy/leiningen -->
View
3  project.clj
@@ -0,0 +1,3 @@
+(defproject kestrel "2.0.0-SNAPSHOT"
+ )
+
View
25 src/main/scala/net/lag/kestrel/MemcacheHandler.scala
@@ -154,8 +154,9 @@ extends NettyHandler[MemcacheRequest](channelGroup, queueCollection, maxOpenTran
return
}
- if ((syn || ack || fail) && (opening || closing || peeking || aborting)
- || (ack && fail)) {
+ if (((syn || ack || fail) && (opening || closing || peeking || aborting))
+ || (ack && fail)
+ || (syn && (ack || fail))) {
channel.write(new MemcacheResponse("CLIENT_ERROR"))
channel.close()
return
@@ -167,10 +168,16 @@ extends NettyHandler[MemcacheRequest](channelGroup, queueCollection, maxOpenTran
} else if (fail) {
if (xid == -1) {
log.warning("Attempt to fail transaction without xid");
+ channel.write(new MemcacheResponse("CLIENT_ERROR"))
+ channel.close()
return
}
- failTransaction(key, xid)
- channel.write(new MemcacheResponse("END"))
+ if(failTransaction(key, xid)) {
+ channel.write(new MemcacheResponse("TRANSACTION_FAIL"))
+ } else {
+ channel.write(new MemcacheResponse("END"));
+ }
+ return;
} else {
if (closing) {
closeTransaction(key)
@@ -179,10 +186,16 @@ extends NettyHandler[MemcacheRequest](channelGroup, queueCollection, maxOpenTran
if (ack) {
if (xid == -1) {
log.warning("Attempt to ack transaction without xid");
+ channel.write(new MemcacheResponse("CLIENT_ERROR"))
+ channel.close()
return
}
- ackTransaction(key, xid)
- if (!opening && !syn) channel.write(new MemcacheResponse("END"))
+ if (ackTransaction(key, xid)) {
+ channel.write(new MemcacheResponse("TRANSACTION_ACK"))
+ } else {
+ channel.write(new MemcacheResponse("END"));
+ }
+ return;
}
if (syn) {
try {

0 comments on commit fc8ca65

Please sign in to comment.
Something went wrong with that request. Please try again.