Changeset 26204 in project


Ignore:
Timestamp:
03/18/12 23:46:03 (9 years ago)
Author:
joseph.gay
Message:

procedure read-job-data for peek and reserve, peek commands should now consume all data in response

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/hen/trunk/hen.scm

    r26203 r26204  
    7979            (read-line tcp-in))) args))
    8080
     81(define (read-job-data res tcp-in)
     82  (if* (string-match "^(?:RESERVED|FOUND) (\\d+) (\\d+)$" res)
     83       `((id . ,(second it))
     84         (data . ,(string-trim-last (read-string (+ 2 (string->number (third it))) tcp-in))))
     85       res))
     86
    8187(define (hen-reserve #!optional (timeout #f) #!key (tcp-in hen-in) (tcp-out hen-out))
    8288  (fluid-let ([tcp-write-timeout (and timeout (* 1000 timeout))])
     
    8490                                   "reserve") "\r")
    8591                tcp-out))
    86   (let ([res (read-line tcp-in)])
    87     (if* (string-match "^RESERVED (\\d+) (\\d+)$" res)
    88          `((id . ,(second it))
    89            (data . ,(read-string (string->number (third it)) tcp-in)))
    90          res)))
     92  (read-job-data (read-line tcp-in) tcp-in))
    9193
    9294(define-syntax define-hen-command
     
    133135  [watch (tube)]
    134136  [ignore (tube)]
    135   [peek (id)]
    136   [peek-ready ()]
    137   [peek-delayed ()]
    138   [peek-buried ()]
     137  [peek (id) (read-job-data res tcp-in)]
     138  [peek-ready () (read-job-data res tcp-in)]
     139  [peek-delayed () (read-job-data res tcp-in)]
     140  [peek-buried () (read-job-data res tcp-in)]
    139141  [kick (bound)]
    140142  [stats-job (id) (read-stats res tcp-in)]
Note: See TracChangeset for help on using the changeset viewer.