/[svn]/liblscp/trunk/src/client.c
ViewVC logotype

Diff of /liblscp/trunk/src/client.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2424 by capela, Sun Feb 24 19:02:30 2013 UTC revision 3664 by schoenebeck, Sun Dec 22 12:53:26 2019 UTC
# Line 2  Line 2 
2  //  //
3  /****************************************************************************  /****************************************************************************
4     liblscp - LinuxSampler Control Protocol API     liblscp - LinuxSampler Control Protocol API
5     Copyright (C) 2004-2013, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2019, rncbc aka Rui Nuno Capela. All rights reserved.
6    
7     This library is free software; you can redistribute it and/or     This library is free software; you can redistribute it and/or
8     modify it under the terms of the GNU Lesser General Public     modify it under the terms of the GNU Lesser General Public
# Line 22  Line 22 
22    
23  #include <locale.h>  #include <locale.h>
24  #include "common.h"  #include "common.h"
25    #include <sys/time.h>
26    #include <sys/errno.h>
27    
28  // Default timeout value (in milliseconds).  // Default timeout value (in milliseconds).
29  #define LSCP_TIMEOUT_MSECS  500  #define LSCP_TIMEOUT_MSECS  500
# Line 156  static void _lscp_client_evt_proc ( void Line 158  static void _lscp_client_evt_proc ( void
158                          } else {                          } else {
159                                  lscp_socket_perror("_lscp_client_evt_proc: recv");                                  lscp_socket_perror("_lscp_client_evt_proc: recv");
160                                  pClient->evt.iState = 0;                                  pClient->evt.iState = 0;
161                                    pClient->iErrno = -errno;
162                          }                          }
163                  }   // Check if select has in error.                  }   // Check if select has in error.
164                  else if (iSelect < 0) {                  else if (iSelect < 0) {
165                          lscp_socket_perror("_lscp_client_evt_proc: select");                          lscp_socket_perror("_lscp_client_evt_proc: select");
166                          pClient->evt.iState = 0;                          pClient->evt.iState = 0;
167                            pClient->iErrno = -errno;
168                  }                  }
169    
170                  // Finally, always signal the event.                  // Finally, always signal the event.
# Line 270  const char* lscp_client_package (void) { Line 274  const char* lscp_client_package (void) {
274  /** Retrieve the current client library version string. */  /** Retrieve the current client library version string. */
275  const char* lscp_client_version (void) { return LSCP_VERSION; }  const char* lscp_client_version (void) { return LSCP_VERSION; }
276    
277  /** Retrieve the current client library build timestamp string. */  /** Retrieve the current client library build string. */
278  const char* lscp_client_build   (void) { return __DATE__ " " __TIME__; }  const char* lscp_client_build   (void) { return LSCP_BUILD; }
279    
280    
281  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
# Line 638  int lscp_client_get_timeout ( lscp_clien Line 642  int lscp_client_get_timeout ( lscp_clien
642          return pClient->iTimeout;          return pClient->iTimeout;
643  }  }
644    
645    /**
646     *  Check whether connection to server is lost.
647     *
648     *  @param pClient  Pointer to client instance structure.
649     *
650     *  @returns @c true if client lost connection to server, @c false otherwise.
651     */
652    bool lscp_client_connection_lost ( lscp_client_t *pClient )
653    {
654        int err = lscp_client_get_errno(pClient);
655        if (err >= 0) return false;
656        return err == -EPIPE || err == -ECONNRESET || err == -ECONNABORTED;
657    }
658    
659    
660  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
661  // Client common protocol functions.  // Client common protocol functions.

Legend:
Removed from v.2424  
changed lines
  Added in v.3664

  ViewVC Help
Powered by ViewVC