Browse Source

add support for _DELETE and _FLUSH commands...

tags/ggatessh-v1.0.0
John-Mark Gurney 4 months ago
parent
commit
b881314655
2 changed files with 16 additions and 0 deletions
  1. +14
    -0
      ggatec/ggatec.c
  2. +2
    -0
      shared/ggate.h

+ 14
- 0
ggatec/ggatec.c View File

@@ -139,6 +139,7 @@ send_thread(void *arg __unused)
if (reconnect)
break;

g_gate_log(LOG_DEBUG, "ggio, ver: %u, unit: %d, seq: %llu, cmd: %u, offset: %llu, len: %llu", ggio.gctl_version, ggio.gctl_unit, ggio.gctl_seq, ggio.gctl_cmd, ggio.gctl_offset, ggio.gctl_length);
switch (ggio.gctl_cmd) {
case BIO_READ:
hdr.gh_cmd = GGATE_CMD_READ;
@@ -146,11 +147,24 @@ send_thread(void *arg __unused)
case BIO_WRITE:
hdr.gh_cmd = GGATE_CMD_WRITE;
break;
case BIO_DELETE:
hdr.gh_cmd = GGATE_CMD_DELETE;
break;
case BIO_FLUSH:
hdr.gh_cmd = GGATE_CMD_FLUSH;
break;
default:
/* XXX - how to handle this? */
g_gate_log(LOG_ERR, "Got unhandled cmd: %d", ggio.gctl_cmd);
reconnect = 1;
pthread_kill(recvtd, SIGUSR1);
break;
}
hdr.gh_seq = ggio.gctl_seq;
hdr.gh_offset = ggio.gctl_offset;
hdr.gh_length = ggio.gctl_length;
hdr.gh_error = 0;
g_gate_log(LOG_DEBUG, "hdr packet, cmd: %hhu, off: %llu, len: %u, seq: %u", hdr.gh_cmd, hdr.gh_offset, hdr.gh_length, hdr.gh_seq);
g_gate_swap2n_hdr(&hdr);

data = g_gate_send(sendfd, &hdr, sizeof(hdr), MSG_NOSIGNAL);


+ 2
- 0
shared/ggate.h View File

@@ -55,6 +55,8 @@

#define GGATE_CMD_READ 0
#define GGATE_CMD_WRITE 1
#define GGATE_CMD_DELETE 2
#define GGATE_CMD_FLUSH 3

extern int g_gate_devfd;
extern int g_gate_verbose;


Loading…
Cancel
Save