Browse Source

* client.c : set timeout for csocket

master
Alex 'AdUser' Z 8 years ago
parent
commit
7d1be8343f
  1. 5
      src/client.c

5
src/client.c

@ -16,10 +16,11 @@
struct { struct {
enum { interactive = 0, oneshot } mode; enum { interactive = 0, oneshot } mode;
int csocket; int csocket;
float timeout;
char csocket_spath[PATH_MAX]; char csocket_spath[PATH_MAX];
char csocket_cpath[PATH_MAX]; char csocket_cpath[PATH_MAX];
} opts = { } opts = {
interactive, -1, interactive, -1, 5.0,
DEFAULT_CSOCKET_PATH, DEFAULT_CSOCKET_PATH,
DEFAULT_CSOCKET_CPATH, /* template */ DEFAULT_CSOCKET_CPATH, /* template */
}; };
@ -120,6 +121,8 @@ int main(int argc, char *argv[]) {
if ((opts.csocket = f2b_csocket_connect(opts.csocket_spath, opts.csocket_cpath)) <= 0) if ((opts.csocket = f2b_csocket_connect(opts.csocket_spath, opts.csocket_cpath)) <= 0)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
f2b_csocket_rtimeout(opts.csocket, opts.timeout);
if (opts.mode == oneshot) { if (opts.mode == oneshot) {
ret = handle_cmd(line); ret = handle_cmd(line);
f2b_csocket_disconnect(opts.csocket, opts.csocket_cpath); f2b_csocket_disconnect(opts.csocket, opts.csocket_cpath);

Loading…
Cancel
Save