⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 conn.h

📁 一个很好用的解析
💻 H
字号:
#ifndef CONN_H_INCLUDED#define CONN_H_INCLUDED#include "xmlrpc-c/abyss.h"#include "socket.h"#include "file.h"#define BUFFER_SIZE 4096 struct _TConn {    struct _TConn * nextOutstandingP;        /* Link to the next connection in the list of outstanding           connections        */    TServer * server;    uint32_t buffersize;        /* Index into the connection buffer (buffer[], below) where           the next byte read on the connection will go.        */    uint32_t bufferpos;        /* Index into the connection buffer (buffer[], below) where           the next byte to be delivered to the user is.        */    uint32_t inbytes,outbytes;      TSocket * socketP;    TIPAddr peerip;    abyss_bool hasOwnThread;    TThread * threadP;    abyss_bool finished;        /* We have done all the processing there is to do on this           connection, other than possibly notifying someone that we're           done.  One thing this signifies is that any thread or process           that the connection spawned is dead or will be dead soon, so           one could reasonably wait for it to be dead, e.g. with           pthread_join().  Note that one can scan a bunch of processes           for 'finished' status, but sometimes can't scan a bunch of           threads for liveness.        */    const char * trace;    TThreadProc * job;    TThreadDoneFn * done;    char buffer[BUFFER_SIZE];};typedef struct _TConn TConn;TConn * ConnAlloc(void);void ConnFree(TConn * const connectionP);voidConnCreate(TConn **            const connectionPP,           TServer *           const serverP,           TSocket *           const connectedSocketP,           TThreadProc *       const job,           TThreadDoneFn *     const done,           enum abyss_foreback const foregroundBackground,           abyss_bool          const useSigchld,           const char **       const errorP);abyss_boolConnProcess(TConn * const connectionP);abyss_boolConnKill(TConn * const connectionP);voidConnWaitAndRelease(TConn * const connectionP);abyss_boolConnWrite(TConn *      const connectionP,          const void * const buffer,          uint32_t     const size);abyss_boolConnRead(TConn *  const c,         uint32_t const timems);voidConnReadInit(TConn * const connectionP);abyss_boolConnReadHeader(TConn * const connectionP,               char ** const headerP);abyss_boolConnWriteFromFile(TConn *  const connectionP,                  TFile *  const file,                  uint64_t const start,                  uint64_t const end,                  void *   const buffer,                  uint32_t const buffersize,                  uint32_t const rate);TServer *ConnServer(TConn * const connectionP);#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -