Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions README-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# FireNio Project

[![Website](https://img.shields.io/badge/website-firenio-green.svg)](https://www.firenio.com)
[![Maven central](https://img.shields.io/badge/maven-1.2.2-green.svg)](http://mvnrepository.com/artifact/com.firenio/firenio-all)
[![Maven central](https://img.shields.io/badge/maven-1.3.2-green.svg)](http://mvnrepository.com/artifact/com.firenio/firenio-all)
[![License](https://img.shields.io/badge/License-Apache%202.0-585ac2.svg)](https://github.com/firenio/firenio/blob/master/LICENSE.txt)

FireNio is an io framework which can build network project fast, it based on java nio, it is popular with Developers because of simple and easy of use APIs and high-performance.
Expand All @@ -15,9 +15,10 @@ FireNio is an io framework which can build network project fast, it based on jav
* WebSocket protocol, for detail: https://www.firenio.com/web-socket/chat/index.html
* Protobase(custom) support text or binay, for detail {firenio-test}
* easy to support reconnect (easy to support heart beat)
* supported ssl (jdkssl, openssl)
* load test
* [tfb benchmark](https://www.techempower.com/benchmarks/#section=test&runid=76a34044-54d6-4349-adfe-863c2d5ae756&hw=ph&test=plaintext)
* supported ssl (JdkSSL & OpenSSL)
* TFB load test
* [TFB Benchmark(Physical)](https://www.techempower.com/benchmarks/#section=data-r18&hw=ph&test=plaintext)
* [TFB Benchmark(Cloud)](https://www.techempower.com/benchmarks/#section=data-r18&hw=cl&test=plaintext)

## Quick Start

Expand All @@ -27,7 +28,7 @@ FireNio is an io framework which can build network project fast, it based on jav
<dependency>
<groupId>com.firenio</groupId>
<artifactId>firenio-all</artifactId>
<version>1.2.2</version>
<version>1.3.2</version>
</dependency>
```

Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# FireNio Project

[![Website](https://img.shields.io/badge/website-firenio-green.svg)](https://www.firenio.com)
[![Maven central](https://img.shields.io/badge/maven-1.2.2-green.svg)](http://mvnrepository.com/artifact/com.firenio/firenio-all)
[![Maven central](https://img.shields.io/badge/maven-1.3.2-green.svg)](http://mvnrepository.com/artifact/com.firenio/firenio-all)
[![License](https://img.shields.io/badge/License-Apache%202.0-585ac2.svg)](https://github.com/firenio/firenio/blob/master/LICENSE.txt)

FireNio是基于java nio开发的一款可快速构建网络通讯项目的异步IO框架,其以简单易用的API和优良的性能深受开发者喜爱。
Expand All @@ -15,9 +15,11 @@ FireNio是基于java nio开发的一款可快速构建网络通讯项目的异
* WebSocket协议,示例: https://www.firenio.com/web-socket/chat/index.html
* Protobase(自定义协议),支持传输文本或二进制数据
* 轻松实现断线重连(轻松实现心跳机制)
* 支持SSL(jdkssl,openssl)
* 压力测试
* [tfb benchmark](https://www.techempower.com/benchmarks/#section=test&runid=76a34044-54d6-4349-adfe-863c2d5ae756&hw=ph&test=plaintext)
* 支持SSL(JdkSSL & OpenSSL)
* TFB压力测试
* [TFB Benchmark(Physical)](https://www.techempower.com/benchmarks/#section=data-r18&hw=ph&test=plaintext)
* [TFB Benchmark(Cloud)](https://www.techempower.com/benchmarks/#section=data-r18&hw=cl&test=plaintext)


## 快速入门

Expand All @@ -27,7 +29,7 @@ FireNio是基于java nio开发的一款可快速构建网络通讯项目的异
<dependency>
<groupId>com.firenio</groupId>
<artifactId>firenio-all</artifactId>
<version>1.2.2</version>
<version>1.3.2</version>
</dependency>
```

Expand Down
4 changes: 2 additions & 2 deletions firenio-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>com.firenio</groupId>
<artifactId>firenio</artifactId>
<version>1.2.2</version>
<version>1.3.2</version>
<relativePath>../firenio/pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -93,7 +93,7 @@
<dependency>
<groupId>org.wildfly.openssl</groupId>
<artifactId>wildfly-openssl-java</artifactId>
<version>1.0.6.Final</version>
<version>1.0.8.Final</version>
<scope>provided</scope>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion firenio-codec/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>com.firenio</groupId>
<artifactId>firenio</artifactId>
<version>1.2.2</version>
<version>1.3.2</version>
<relativePath>../firenio/pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public ByteBuf encode(Channel ch, Frame frame) {
boolean isArray = false;
int write_size = 0;
if (content instanceof ByteBuf) {
contentBuf = ((ByteBuf) content).flip();
write_size = contentBuf.limit();
contentBuf = ((ByteBuf) content);
write_size = contentBuf.writeIndex();
} else if (content instanceof byte[]) {
isArray = true;
contentArray = (byte[]) content;
Expand All @@ -77,12 +77,12 @@ public ByteBuf encode(Channel ch, Frame frame) {
int len_len = 32 - len_idx;
int len = mtd_bytes.length + 1 + url_bytes.length + PROTOCOL.length + len_len + 2;
int header_size = 0;
List<byte[]> bytes_array = getEncodeBytesArray(FastThreadLocal.get());
List<byte[]> bytes_array = (List<byte[]>) FastThreadLocal.get().getList();
IntMap<String> headers = f.getRequestHeaders();
if (headers != null) {
headers.remove(HttpHeader.Content_Length.getId());
for (headers.scan(); headers.hasNext(); ) {
byte[] k = HttpHeader.get(headers.nextKey()).getBytes();
byte[] k = HttpHeader.get(headers.key()).getBytes();
byte[] v = headers.value().getBytes();
if (v == null) {
continue;
Expand All @@ -100,34 +100,34 @@ public ByteBuf encode(Channel ch, Frame frame) {
len += write_size;
}
ByteBuf buf = ch.alloc().allocate(len);
buf.putBytes(mtd_bytes);
buf.putByte(SPACE);
buf.putBytes(url_bytes);
buf.putBytes(PROTOCOL);
buf.putBytes(byte32, len_idx, len_len);
buf.putByte(R);
buf.putByte(N);
buf.writeBytes(mtd_bytes);
buf.writeByte(SPACE);
buf.writeBytes(url_bytes);
buf.writeBytes(PROTOCOL);
buf.writeBytes(byte32, len_idx, len_len);
buf.writeByte(R);
buf.writeByte(N);
int j = 0;
for (int i = 0; i < header_size; i++) {
buf.putBytes(bytes_array.get(j++));
buf.putByte((byte) ':');
buf.putByte(SPACE);
buf.putBytes(bytes_array.get(j++));
buf.putByte(R);
buf.putByte(N);
buf.writeBytes(bytes_array.get(j++));
buf.writeByte((byte) ':');
buf.writeByte(SPACE);
buf.writeBytes(bytes_array.get(j++));
buf.writeByte(R);
buf.writeByte(N);
}
buf.putByte(R);
buf.putByte(N);
buf.writeByte(R);
buf.writeByte(N);
if (write_size > 0) {
if (isArray) {
buf.putBytes(contentArray);
buf.writeBytes(contentArray);
} else {
ch.write(buf.flip());
ch.write(buf);
ch.write(contentBuf);
return null;
}
}
return buf.flip();
return buf;
}

private String getRequestURI(HttpFrame frame) {
Expand Down
Loading