generated from mingliqiye/lib-tem
Compare commits
4 Commits
Auto-Relea
...
master
Author | SHA1 | Date | |
---|---|---|---|
dbace3d454 | |||
b033732949 | |||
2ec34c056f | |||
0d420d57f2 |
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
@ -38,8 +37,8 @@ dependencies {
|
|||||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||||
implementation("org.jetbrains:annotations:24.0.0")
|
implementation("org.jetbrains:annotations:24.0.0")
|
||||||
annotationProcessor("org.jetbrains:annotations:24.0.0")
|
annotationProcessor("org.jetbrains:annotations:24.0.0")
|
||||||
implementation("com.mingliqiye:network-endpoint:1.0.2")
|
implementation("com.mingliqiye:network-endpoint:1.0.4")
|
||||||
implementation("com.mingliqiye:string-utilts:1.0.4")
|
implementation("com.mingliqiye:string-utils:1.0.4")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.test {
|
tasks.test {
|
||||||
|
27
build.yaml
27
build.yaml
@ -1,27 +0,0 @@
|
|||||||
name: Gitea Actions Build
|
|
||||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
jobs:
|
|
||||||
Build:
|
|
||||||
runs-on: ubuntu-dev
|
|
||||||
steps:
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: https://git.mingliqiye.com/Actions/checkout@v4
|
|
||||||
|
|
||||||
- name: build-test
|
|
||||||
run: |
|
|
||||||
source gradle.properties
|
|
||||||
gradle
|
|
||||||
gradle build-jar
|
|
||||||
|
|
||||||
- name: Releases
|
|
||||||
run: |
|
|
||||||
source gradle.properties
|
|
||||||
SHA=${{gitea.sha}}
|
|
||||||
curl -o- https://git.mingliqiye.com/Actions/com.mingliqiye.gitea.releases/raw/branch/master/install.sh | bash
|
|
||||||
FILENAME="${GROUPSID}-${VERSIONS}.jar"
|
|
||||||
java -jar com.mingliqiye.gitea.releases.jar -s "${{gitea.server_url}}" -o "${{gitea.repository_owner}}" -r ${{gitea.event.repository.name}} -t "${{gitea.token}}" -ti "Auto releases ${{gitea.sha}} ${VERSIONS}" -b "# Auto releases wtih ${{gitea.event.head_commit.message}} - [${{gitea.sha}}](${{gitea.event.head_commit.url}})" -tn "Auto-Releases-${VERSIONS}-${SHA:0:10}" -a "build/libs"
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
GROUPSID=com.mingliqiye
|
GROUPSID=com.mingliqiye
|
||||||
ARTIFACTID=socket-utilts
|
ARTIFACTID=socket-utilts
|
||||||
VERSIONS=1.0.4
|
VERSIONS=1.0.7
|
||||||
MAINCLASS=com.mingliqiye.Main
|
MAINCLASS=com.mingliqiye.Main
|
||||||
JDKVERSIONS=1.8
|
JDKVERSIONS=1.8
|
||||||
|
@ -6,7 +6,7 @@ import java.net.ServerSocket;
|
|||||||
|
|
||||||
public class DefTcpServerImplementation extends TcpServerImplementation {
|
public class DefTcpServerImplementation extends TcpServerImplementation {
|
||||||
|
|
||||||
boolean connect(TcpSocketClient client, String id) {
|
public boolean connect(TcpSocketClient client, String id) {
|
||||||
System.out.println(
|
System.out.println(
|
||||||
StringUtil.format(
|
StringUtil.format(
|
||||||
"客户端 {} ID={} 连接成功",
|
"客户端 {} ID={} 连接成功",
|
||||||
@ -17,7 +17,7 @@ public class DefTcpServerImplementation extends TcpServerImplementation {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void disconnect(TcpSocketClient client, String id) {
|
public void disconnect(TcpSocketClient client, String id) {
|
||||||
System.out.println(
|
System.out.println(
|
||||||
StringUtil.format(
|
StringUtil.format(
|
||||||
"客户端 {} ID={} 断开连接",
|
"客户端 {} ID={} 断开连接",
|
||||||
@ -27,7 +27,7 @@ public class DefTcpServerImplementation extends TcpServerImplementation {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reception(
|
public void reception(
|
||||||
TcpSocketClient client,
|
TcpSocketClient client,
|
||||||
BufferBytesEntity bufferBytesEntity
|
BufferBytesEntity bufferBytesEntity
|
||||||
) {
|
) {
|
||||||
@ -46,7 +46,7 @@ public class DefTcpServerImplementation extends TcpServerImplementation {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void started(ServerSocket serverSocket) {
|
public void started(ServerSocket serverSocket) {
|
||||||
System.out.println(
|
System.out.println(
|
||||||
StringUtil.format(
|
StringUtil.format(
|
||||||
"服务器启动 监听 {}",
|
"服务器启动 监听 {}",
|
||||||
@ -57,7 +57,7 @@ public class DefTcpServerImplementation extends TcpServerImplementation {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void closed() {
|
public void closed() {
|
||||||
System.out.println("服务器已经关闭");
|
System.out.println("服务器已经关闭");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,21 +14,21 @@ public abstract class TcpServerImplementation {
|
|||||||
* @param id 客户端ID
|
* @param id 客户端ID
|
||||||
* @return 是否允许连接
|
* @return 是否允许连接
|
||||||
*/
|
*/
|
||||||
abstract boolean connect(TcpSocketClient client, String id);
|
public abstract boolean connect(TcpSocketClient client, String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 断开连接回调函数
|
* 断开连接回调函数
|
||||||
* @param client 客户端
|
* @param client 客户端
|
||||||
* @param id 客户端ID
|
* @param id 客户端ID
|
||||||
*/
|
*/
|
||||||
abstract void disconnect(TcpSocketClient client, String id);
|
public abstract void disconnect(TcpSocketClient client, String id);
|
||||||
|
|
||||||
abstract void reception(
|
public abstract void reception(
|
||||||
TcpSocketClient client,
|
TcpSocketClient client,
|
||||||
BufferBytesEntity bufferBytesEntity
|
BufferBytesEntity bufferBytesEntity
|
||||||
);
|
);
|
||||||
|
|
||||||
abstract void started(ServerSocket serverSocket);
|
public abstract void started(ServerSocket serverSocket);
|
||||||
|
|
||||||
abstract void closed();
|
public abstract void closed();
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public class TcpSocketServer extends Thread implements AutoCloseable {
|
|||||||
);
|
);
|
||||||
if (!tcpServerImplementation.connect(tcpSocketClient, uuid)) {
|
if (!tcpServerImplementation.connect(tcpSocketClient, uuid)) {
|
||||||
tcpSocketClient.close();
|
tcpSocketClient.close();
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
clientMap.put(uuid, tcpSocketClient);
|
clientMap.put(uuid, tcpSocketClient);
|
||||||
tcpSocketClient.start();
|
tcpSocketClient.start();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user